2 #include "RenderTarget.h" 3 #include "SceneState.h" 15 class IBatchedElementDraw;
16 class CBatchedElementDraw;
35 virtual CBaseObject::_SceneObjectType GetType(){
return CBaseObject::MiniSceneGraph;};
48 ATTRIBUTE_METHOD1(
CMiniSceneGraph, IsLightEnabled_s,
bool*) {*p1 = cls->IsLightEnabled();
return S_OK;}
49 ATTRIBUTE_METHOD1(
CMiniSceneGraph, EnableLight_s,
bool) {cls->EnableLight(p1);
return S_OK;}
51 ATTRIBUTE_METHOD1(
CMiniSceneGraph, GetBackGroundColor_s,
Vector3*) { *p1 = cls->GetBackGroundColor().ToVector3();
return S_OK; }
54 ATTRIBUTE_METHOD1(
CMiniSceneGraph, IsSunLightEnabled_s,
bool*) {*p1 = cls->IsSunLightEnabled();
return S_OK;}
55 ATTRIBUTE_METHOD1(
CMiniSceneGraph, EnableSunLight_s,
bool) {cls->EnableSunLight(p1);
return S_OK;}
57 ATTRIBUTE_METHOD1(
CMiniSceneGraph, IsFogEnabled_s,
bool*) {*p1 = cls->IsFogEnabled();
return S_OK;}
58 ATTRIBUTE_METHOD1(
CMiniSceneGraph, EnableFog_s,
bool) {cls->EnableFog(p1);
return S_OK;}
60 ATTRIBUTE_METHOD1(
CMiniSceneGraph, GetFogColor_s,
Vector3*) {*p1 = cls->GetFogColorFactor().ToVector3();
return S_OK;}
63 ATTRIBUTE_METHOD1(
CMiniSceneGraph, GetFogStart_s,
float*) {*p1 = cls->GetFogStart();
return S_OK;}
64 ATTRIBUTE_METHOD1(
CMiniSceneGraph, SetFogStart_s,
float) {cls->SetFogStart(p1);
return S_OK;}
66 ATTRIBUTE_METHOD1(
CMiniSceneGraph, GetFogEnd_s,
float*) {*p1 = cls->GetFogEnd();
return S_OK;}
67 ATTRIBUTE_METHOD1(
CMiniSceneGraph, SetFogEnd_s,
float) {cls->SetFogEnd(p1);
return S_OK;}
69 ATTRIBUTE_METHOD1(
CMiniSceneGraph, GetFogDensity_s,
float*) {*p1 = cls->GetFogDensity();
return S_OK;}
70 ATTRIBUTE_METHOD1(
CMiniSceneGraph, SetFogDensity_s,
float) {cls->SetFogDensity(p1);
return S_OK;}
72 ATTRIBUTE_METHOD1(
CMiniSceneGraph, IsRenderSky_s,
bool*) {*p1 = cls->IsRenderSky();
return S_OK;}
73 ATTRIBUTE_METHOD1(
CMiniSceneGraph, EnableSkyRendering_s,
bool) {cls->EnableSkyRendering(p1);
return S_OK;}
75 ATTRIBUTE_METHOD1(
CMiniSceneGraph, IsHeadOnDisplayShown_s,
bool*) {*p1 = cls->IsHeadOnDisplayShown();
return S_OK;}
76 ATTRIBUTE_METHOD1(
CMiniSceneGraph, ShowHeadOnDisplay_s,
bool) {cls->ShowHeadOnDisplay(p1);
return S_OK;}
78 ATTRIBUTE_METHOD1(
CMiniSceneGraph, IsUsePointTexture_s,
bool*) { *p1 = cls->IsUsePointTexture();
return S_OK; }
79 ATTRIBUTE_METHOD1(
CMiniSceneGraph, SetUsePointTexture_s,
bool) { cls->SetUsePointTexture(p1);
return S_OK; }
81 ATTRIBUTE_METHOD1(
CMiniSceneGraph, GetMaxHeadOnDisplayDistance_s,
float*) {*p1 = cls->GetMaxHeadOnDisplayDistance();
return S_OK;}
82 ATTRIBUTE_METHOD1(
CMiniSceneGraph, SetMaxHeadOnDisplayDistance_s,
float) {cls->SetMaxHeadOnDisplayDistance(p1);
return S_OK;}
84 ATTRIBUTE_METHOD1(
CMiniSceneGraph, GetRenderPipelineOrder_s,
int*) {*p1 = cls->GetRenderPipelineOrder();
return S_OK;}
85 ATTRIBUTE_METHOD1(
CMiniSceneGraph, SetRenderPipelineOrder_s,
int) {cls->SetRenderPipelineOrder(p1);
return S_OK;}
90 void EnableSkyRendering(
bool bEnable){m_bRenderSky = bEnable;};
94 const LinearColor& GetFogColorFactor(){
return m_FogColorFactor;};
97 void SetFogStart(
float fFogStart);
99 void SetFogEnd(
float fFogEnd);
101 void SetFogDensity(
float fFogDensity);
102 float GetFogDensity();
103 void EnableFog(
bool bEnableFog);
123 bool CreateSkyBox(
const string& strObjectName,
AssetEntity& MeshAsset,
float fScaleX,
float fScaleY,
float fScaleZ,
float fHeightOffset);
172 void CameraGetLookAtPos(
float* x,
float* y,
float* z);
181 void CameraGetEyePosByAngle(
float* fRotY,
float* fLiftupAngle,
float* fCameraObjectDist);
182 void CameraSetEyePos(
double x,
double y,
double z);
183 void CameraGetEyePos(
double* x,
double* y,
double* z);
217 int RenderSelection(DWORD dwSelection=0xffffffff,
double dTimeDelta=0);
225 void Draw(
float fDeltaTime);
237 void SetName(
const char* sName);
266 int RemoveObject(
const char* name,
bool bRecursive =
false);
277 int DestroyObject(
const char* name,
bool bRecursive =
false);
312 bool IsUsePointTexture()
const;
313 void SetUsePointTexture(
bool val);
363 typedef std::map<std::string, CBaseObject*> ObjectNameMap_Type;
364 ObjectNameMap_Type m_name_map;
370 bool m_bUseLocalCamera;
373 bool m_bUsePointTexture;
378 asset_ptr<TextureEntity> m_pMask;
390 bool m_bShowHeadOnDisplay;
393 float m_fMaxHeadOnDisplayDistance;
410 bool m_bEnableLighting;
413 bool m_bEnableSunLight;
423 int m_nRenderPipelineOrder;
428 void Draw_Internal(
float fDeltaTime);
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
Used for viewing objects on 3D canvas.
Definition: CanvasCamera.h:9
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object's name
Definition: MiniSceneGraph.h:42
int GetRenderPipelineOrder()
default to PIPELINE_3D_SCENE.
Definition: MiniSceneGraph.cpp:1337
It's used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
bool SetEffect(CEffectFile *pEffect)
set the current effect
int PrepareRender(CBaseCamera *pCamera, SceneState *pSceneState)
this function is called at the beginning of each frame to build the scene state from the specified ca...
Definition: MiniSceneGraph.cpp:831
Basic scene interface: implemented by the CSceneObject and CMiniScenegraph class. ...
Definition: IScene.h:12
CSkyMesh * GetCurrentSky()
return NULL if no sky defined.
Definition: MiniSceneGraph.cpp:1434
a render target scene object.
Definition: RenderTarget.h:16
Mini scene graph does not use a spatial partitions for its stored objects, instead it just implement ...
Definition: MiniSceneGraph.h:29
different physics engine has different winding order.
Definition: EventBinding.h:32
void CameraSetLookAtPos(float x, float y, float z)
set the camera look at position
Definition: MiniSceneGraph.cpp:709
CCanvasCamera * GetCamera()
get the camera object.
Definition: MiniSceneGraph.cpp:96
CSunLight & GetSunLight()
get sun light object
Definition: MiniSceneGraph.cpp:1483
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: MiniSceneGraph.cpp:1498
void CameraSetEyePosByAngle(float fRotY, float fLiftupAngle, float fCameraObjectDist)
set the camera eye position
Definition: MiniSceneGraph.cpp:723
void SetRenderPipelineOrder(int nOrder)
default to PIPELINE_3D_SCENE.
Definition: MiniSceneGraph.cpp:1332
Modeling the global sun and its directional light, including sun position, direction, color, time of day, etc.
Definition: SunLight.h:26
void SetBackGroundColor(const LinearColor &bgColor)
set the color of the scene ground when it is not enabled.When scene is enabled, the background color ...
Definition: MiniSceneGraph.cpp:1357
the sky object in the scene.
Definition: SkyMesh.h:13
bool IsRenderSky()
whether rendering the sky
Definition: MiniSceneGraph.h:89
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
void ShowHeadOnDisplay(bool bShow)
show or hide all scene's objects' head on display
Definition: MiniSceneGraph.h:301
Definition: BaseCamera.h:70
IBatchedElementDraw * GetBatchedElementDrawer()
get debug draw
Definition: MiniSceneGraph.cpp:1342
const char * GetName()
get name
Definition: MiniSceneGraph.cpp:350
float GetMaxHeadOnDisplayDistance()
whether all scene's objects' head on display
Definition: MiniSceneGraph.h:310
bool CreateSkyBox(const string &strObjectName, AssetEntity &MeshAsset, float fScaleX, float fScaleY, float fScaleZ, float fHeightOffset)
create a sky box and add it to the current list, and select it as the current skybox.
Definition: MiniSceneGraph.cpp:1441
IParaDebugDraw draw interface draws line based primitives for debugging purposes. ...
Definition: IBatchedElementDraw.h:12
int DestroyObject(const char *name, bool bRecursive=false)
destroy all objects with the given name.
Definition: MiniSceneGraph.cpp:178
bool IsNeedUpdate()
even when active rendering is on, the mini scene graph will not update itself, if need update is fals...
Definition: MiniSceneGraph.cpp:1367
void CameraRotate(float dx, float dy, float dz)
rotate the camera round the object on canvas
Definition: MiniSceneGraph.cpp:699
int RenderSelection(DWORD dwSelection=0xffffffff, double dTimeDelta=0)
render objects in the post rendering list.
Definition: MiniSceneGraph.cpp:895
void Reset()
clear the entire scene graph
Definition: MiniSceneGraph.cpp:302
weak reference ptr use in a class like this: weak_ptr<CRefCounted> p; e.g.
Definition: PERef.h:105
void Draw(float fDeltaTime)
draw the content of the scene graph to the current render target.
Definition: MiniSceneGraph.cpp:618
Definition: ShapeSphere.h:6
void CameraZoomSphere(const CShapeSphere &sphere)
reset the camera parameters to view the entire sphere at best (default) distance
Definition: MiniSceneGraph.cpp:694
SceneState * GetSceneState()
get the scene state information.
Definition: MiniSceneGraph.h:294
void CameraZoom(float fAmount)
Zoom the camera.
Definition: MiniSceneGraph.cpp:689
CBaseCamera * GetCurrentCamera()
get the current camera
Definition: MiniSceneGraph.h:154
bool IsHeadOnDisplayShown()
whether all scene's objects' head on display
Definition: MiniSceneGraph.h:304
bool IsLightEnabled()
get light enable state
Definition: MiniSceneGraph.cpp:1376
CBaseObject * GetObject(const char *name, bool bRecursive=false)
get object by name, if there are multiple objects with the same name, the last added one is inserted...
Definition: MiniSceneGraph.cpp:143
Vector3 GetRenderOrigin()
get the render origin in the rendering coordinate system.rendering coordinate system is a 3D coordina...
Definition: MiniSceneGraph.cpp:1127
void SetActor(CBaseObject *pActor)
set the actor: The camera always focuses on actor, so this actor can be used to control the current c...
Definition: MiniSceneGraph.cpp:340
Definition: effect_file.h:323
bool(* OBJECT_FILTER_CALLBACK)(CBaseObject *obj)
call back function type for ray picking.
Definition: MiniSceneGraph.h:19
void SetMaskTexture(TextureEntity *pTexture)
this is an optional 2D mask, which is drawn over the entire canvas after scene is rendered in to it...
Definition: MiniSceneGraph.cpp:103
virtual void Cleanup()
clean up all resource objects
Definition: MiniSceneGraph.cpp:82
void EnableLight(bool bEnable)
whether use light
Definition: MiniSceneGraph.cpp:1381
int RemoveObject(const char *name, bool bRecursive=false)
remove an object from this scene graph but do not destroy it.
Definition: MiniSceneGraph.cpp:226
void SetName(const char *sName)
set the object name.
Definition: MiniSceneGraph.cpp:355
bool PickObject(const CShapeRay &ray, CBaseObject **pTouchedObject, float fMaxDistance=0, OBJECT_FILTER_CALLBACK pFnctFilter=NULL)
Definition: MiniSceneGraph.cpp:1163
bool DeleteSkyBox(const string &strObjectName)
delete a name sky box.
Definition: MiniSceneGraph.cpp:1474
void EnableSunLight(bool bEnable)
whether use light
Definition: MiniSceneGraph.cpp:1493
int RenderHeadOnDisplay()
render the head on display, return the number of objects rendered
Definition: MiniSceneGraph.cpp:587
LinearColor GetBackGroundColor()
Get the color of the scene ground when it is not enabled.When scene is enabled, the background color ...
Definition: MiniSceneGraph.cpp:1362
bool IsSunLightEnabled()
get light enable state
Definition: MiniSceneGraph.cpp:1489
virtual bool PrepareRenderObject(CBaseObject *pObj, CBaseCamera *pCamera, SceneState &sceneState)
decide whether pObj is visible by the pCamera, if so, it will add it to the proper render queue in sc...
Definition: MiniSceneGraph.cpp:748
void CameraPan(float dx, float dy)
pan the camera
Definition: MiniSceneGraph.cpp:704
void SetFogColorFactor(const LinearColor &fogColorFactor)
fog parameters
Definition: MiniSceneGraph.h:93
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
A ray is a half-line P(t) = mOrig + mDir * t, with 0 <= t <= +infinity.
Definition: ShapeRay.h:11
void SetMaxHeadOnDisplayDistance(float fDist)
show or hide all scene's objects' head on display
Definition: MiniSceneGraph.h:307
virtual void DestroyChildren()
Completely destroy child nodes from memory recursively.
Definition: MiniSceneGraph.cpp:683
A linear, 32-bit/component floating point RGBA color.
Definition: ParaColor.h:12
for drawing special element object(like particles, lines, etc) in the scene.
Definition: BatchedElementDraw.h:15
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: MiniSceneGraph.h:40
CBaseObject * GetActor()
get the current actor
Definition: MiniSceneGraph.cpp:345
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
bool IsCameraEnabled()
whether camera is enabled.
Definition: MiniSceneGraph.cpp:138
virtual void AddChild(CBaseObject *pObject)
add another object as the child of this object
Definition: MiniSceneGraph.cpp:311
void EnableCamera(bool bEnable)
enable or disable a given camera
Definition: MiniSceneGraph.cpp:111
CMiniSceneGraph(void)
Definition: MiniSceneGraph.cpp:44
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: MiniSceneGraph.h:44