6 #ifndef CNOID_UTIL_SCENE_RENDERER_H
7 #define CNOID_UTIL_SCENE_RENDERER_H
11 #include "exportdecl.h"
23 void setName(
const std::string& name);
24 const std::string& name()
const;
26 static void addExtension(std::function<
void(
SceneRenderer* renderer)> func);
27 virtual void applyExtensions();
28 virtual bool applyNewExtensions();
30 virtual SgGroup* sceneRoot() = 0;
32 virtual void clearScene();
38 virtual void renderCustomGroup(
SgGroup* group, std::function<
void()> traverseFunction) = 0;
39 virtual void renderCustomTransform(
SgTransform* transform, std::function<
void()> traverseFunction) = 0;
40 virtual void renderNode(
SgNode* node) = 0;
44 virtual void clearNodeDecorations(
int id) = 0;
46 int numCameras()
const;
49 const Isometry3& cameraPosition(
int index)
const;
50 const Isometry3& currentCameraPosition()
const;
53 int currentCameraIndex()
const;
54 void setCurrentCamera(
int index);
55 bool setCurrentCamera(
SgCamera* camera);
57 std::vector<std::string> simplifiedCameraPathStrings(
int cameraIndex);
58 bool getSimplifiedCameraPathStrings(
int cameraIndex, std::vector<std::string>& out_pathStrings);
59 int findCameraPath(
const std::vector<std::string>& simplifiedPathStrings);
60 bool setCurrentCameraPath(
const std::vector<std::string>& simplifiedPathStrings);
61 void setCurrentCameraAutoRestorationMode(
bool on);
63 int numLights()
const;
64 void getLightInfo(
int index,
SgLight*& out_light,
Isometry3& out_position)
const;
65 void setAsDefaultLight(
SgLight* light);
66 void unsetDefaultLight(
SgLight* light);
68 void setHeadLight(
SgLight* light);
69 void enableAdditionalLights(
bool on);
71 void enableFog(
bool on);
72 bool isFogEnabled()
const;
74 SgFog* fog(
int index)
const;
76 virtual const Affine3& currentModelTransform()
const = 0;
77 virtual const Matrix4& projectionMatrix()
const = 0;
78 virtual double projectedPixelSizeRatio(
const Vector3& position)
const = 0;
84 void extractPreprocessedNodes();
92 void setFlagVariableToUpdatePreprocessedNodeTree(
bool& flag);
95 bool pick(
int x,
int y);
97 virtual bool isRenderingPickingImage()
const;
103 friend class SceneRenderer::Impl;
109 bool property(
PropertyKey key,
bool defaultValue)
const;
110 int property(
PropertyKey key,
int defaultValue)
const;
111 double property(
PropertyKey key,
double defaultValue)
const;
114 virtual void doRender() = 0;
115 virtual bool doPick(
int x,
int y);