5 #ifndef BALL_VIEW_RENDERING_RENDERERS_RTFACTRENDERER_H
6 #define BALL_VIEW_RENDERING_RENDERERS_RTFACTRENDERER_H
8 #define BALLVIEW_RTFACTRENDERER_THROW(exceptionName, message) (throw BALL::Exception::##exceptionName##(__FILE__, __LINE__, message))
20 #include <RTpieCpp/RayTracerHandle.hpp>
21 #include <RTfact/Model/Image/BasicImage2D.hpp>
22 #include <RTfact/Model/Framebuffer/Image2DFramebuffer.hpp>
23 #include <RTfact/Utils/FPSMeter.hpp>
28 struct hash< RTpieCpp::MeshHandle >
37 size_t operator()(
const RTpieCpp::MeshHandle& x )
const throw() {
45 struct hash< RTpieCpp::InstanceHandle >
54 size_t operator()(
const RTpieCpp::InstanceHandle& x )
const throw() {
112 rtfact_needs_update_(false)
132 return "RTfact-RTRemote Ray Tracer";
141 std::list<GeometricObject*>& objects);
145 virtual void setSize(
float width,
float height);
147 virtual void setupStereo(
float eye_separation,
float focal_length);
149 virtual void getFrustum(
float& near_f,
float& far_f,
float& left_f,
float& right_f,
float& top_f,
float& bottom_f);
150 virtual void setFrustum(
float near_f,
float far_f,
float left_f,
float right_f,
float top_f,
float bottom_f);
193 static const float vectorDifferenceTolerance_;
197 template<
typename taPixelType>
198 void renderImpl(taPixelType* buffer,
const unsigned int width,
const unsigned int height,
const unsigned int pitch);
200 void renderImpl(
float* buffer,
const unsigned int width,
const unsigned int height,
const unsigned int pitch)
204 std::vector<RTpieCpp::LightHandle> lights_;
206 typedef RTfact::BasicImage2D<float> t_ColorImage;
207 typedef RTfact::BasicImage2D<float> t_DistanceImage;
208 typedef RTfact::Image2DFramebuffer<
210 t_DistanceImage> t_Framebuffer;
212 typedef RTfact::BasicImage2D<unsigned char> t_ByteColorImage;
213 typedef RTfact::BasicImage2D<unsigned char> t_ByteDistanceImage;
214 typedef RTfact::Image2DFramebuffer<
216 t_ByteDistanceImage> t_ByteFramebuffer;
218 RTpieCpp::SceneHandle sceneHandle;
219 RTpieCpp::RayTracerHandle rayTracer;
220 RTpieCpp::CameraHandle cameraHandle;
221 RTpieCpp::FrameBufferHandle renderBuffer;
222 RTpieCpp::RenderTaskHandle renderTask;
223 t_Framebuffer framebuffer;
224 t_ByteFramebuffer byteFramebuffer;
227 RTfact::FPSMeter fpsMeter;
228 RTpieCpp::PickTaskHandle pickTask;
237 bool rtfact_needs_update_;
BALL_EXTERN_VARIABLE const double c
boost::shared_ptr< FrameBuffer > FrameBufferPtr
HashMap class based on the STL map (containing serveral convenience functions)
size_t operator()(const RTpieCpp::MeshHandle &x) const
size_t operator()(const RTpieCpp::InstanceHandle &x) const
void removeRepresentation(const Representation &rep)
virtual void formatUpdated()
void transformLine(const TwoColoredLine &line, float *trafo)
virtual void setFrustum(float near_f, float far_f, float left_f, float right_f, float top_f, float bottom_f)
virtual void pickObjects(Position x1, Position y1, Position x2, Position y2, std::list< GeometricObject * > &objects)
void transformTube(const TwoColoredTube &tube, float *trafo)
void updateCamera(const Camera *camera=0)
virtual bool hasFPScounter()
virtual ~RTfactRenderer()
Destructor.
void updateMaterialForRepresentation(Representation const *rep)
virtual void setSize(float width, float height)
Set the size of the display.
virtual std::vector< float > intersectRaysWithGeometry(const std::vector< Vector3 > &origins, const std::vector< Vector3 > &directions)
virtual void setupStereo(float eye_separation, float focal_length)
virtual String getRenderer()
void setLights(bool reset_all=false)
Set the light sources according to the stage.
void bufferRepresentationDynamic(const Representation &rep)
virtual void useContinuousLoop(bool use_loop)
void setupEnvironmentMap(const QImage &image)
Setup an environment map.
void updateBackgroundColor()
Update the background color from the stage.
virtual void prepareBufferedRendering(const Stage &stage)
void updateMaterialFromStage(RTpieCpp::AppearanceHandle &material)
void convertMaterial(Stage::Material const &rt_material, RTpieCpp::AppearanceHandle &material)
void bufferRepresentation(const Representation &rep)
virtual void getFrustum(float &near_f, float &far_f, float &left_f, float &right_f, float &top_f, float &bottom_f)
virtual void renderToBufferImpl(FrameBufferPtr buffer)
RTfactRenderer()
Default Constructor.
virtual bool init(Scene &scene)
virtual GeometricObject * pickObject(Position x, Position y)
std::vector< RTpieCpp::InstanceHandle > instance_handles
The instances (visible objects)
RTpieCpp::AppearanceHandle cutPlaneShader
Cut-planes material.
std::vector< RTpieCpp::GeometryHandle > cutPlanes
Cut-plane geometries.
std::vector< RTpieCpp::GeometryHandle > object_handles
The object handles (all objects)
std::vector< RTpieCpp::InstanceHandle > cutPlaneInstances
Cut-plane instances.
std::vector< RTpieCpp::MeshHandle > mesh_handles
The meshes.
std::vector< RTpieCpp::AppearanceHandle > material_handles
The materials.
std::vector< RTpieCpp::MeshHandle > cutPlaneMeshes
Cut-plane meshes.
bool has_been_disabled
Mark previously disabled representations.