Browse Source

Scene. Wont compile

Panagiotis Christopoulos Charitos 14 years ago
parent
commit
e9cb25caa6

+ 0 - 3
src/scene/Camera.h

@@ -61,9 +61,6 @@ class Camera: public SceneNode, public VisibilityInfo
 		/// - Update frustum planes
 		/// - Update frustum planes
 		void moveUpdate();
 		void moveUpdate();
 
 
-		/// Do nothing
-		void init(const char*) {}
-
 		/// @name Frustum checks
 		/// @name Frustum checks
 		/// @{
 		/// @{
 
 

+ 2 - 4
src/scene/Light.h

@@ -41,8 +41,6 @@ class Light: public SceneNode, public VisibilityInfo
 
 
 		void init(const char* filename);
 		void init(const char* filename);
 
 
-		void frameUpdate(float /*prevUpdateTime*/, float /*crntTime*/) {}
-
 	protected:
 	protected:
 		RsrcPtr<LightRsrc> lightData;
 		RsrcPtr<LightRsrc> lightData;
 		Vec3 diffuseCol; ///< Diffuse color
 		Vec3 diffuseCol; ///< Diffuse color
@@ -59,8 +57,8 @@ inline Light::Light(ClassId cid, Scene& scene, ulong flags, SceneNode* parent)
 inline bool Light::classof(const SceneNode* x)
 inline bool Light::classof(const SceneNode* x)
 {
 {
 	return x->getClassId() == CID_LIGHT ||
 	return x->getClassId() == CID_LIGHT ||
-		x->getClassId() == CID_SPOT_LIGHT ||
-		x->getClassId() == CID_POINT_LIGHT;
+		x->getClassId() == CID_POINT_LIGHT ||
+		x->getClassId() == CID_SPOT_LIGHT;
 }
 }
 
 
 
 

+ 9 - 6
src/scene/ModelNode.cpp

@@ -5,16 +5,19 @@
 
 
 
 
 //==============================================================================
 //==============================================================================
-// Constructor                                                                 =
+// Constructors & destructor                                                   =
 //==============================================================================
 //==============================================================================
-ModelNode::ModelNode(bool inheritParentTrfFlag, SceneNode* parent)
-:	SceneNode(SNT_MODEL, inheritParentTrfFlag, parent)
+
+ModelNode::ModelNode(Scene& scene, ulong flags, SceneNode* parent)
+:	SceneNode(CID_MODEL_NODE, scene, flags, parent)
+{}
+
+
+ModelNode::ModelNode(ClassId cid, Scene& scene, ulong flags, SceneNode* parent)
+:	SceneNode(cid, scene, flags, parent)
 {}
 {}
 
 
 
 
-//==============================================================================
-// Destructor                                                                  =
-//==============================================================================
 ModelNode::~ModelNode()
 ModelNode::~ModelNode()
 {}
 {}
 
 

+ 11 - 1
src/scene/ModelNode.h

@@ -17,9 +17,12 @@ class Model;
 class ModelNode: public SceneNode
 class ModelNode: public SceneNode
 {
 {
 	public:
 	public:
-		ModelNode(bool inheritParentTrfFlag, SceneNode* parent);
+		ModelNode(ClassId cid, Scene& scene, ulong flags, SceneNode* parent);
+		ModelNode(Scene& scene, ulong flags, SceneNode* parent);
 		virtual ~ModelNode();
 		virtual ~ModelNode();
 
 
+		static bool classof(const SceneNode* x);
+
 		/// @name Accessors
 		/// @name Accessors
 		/// @{
 		/// @{
 		GETTER_RW(Vec<ModelPatchNode*>, patches, getModelPatchNodes)
 		GETTER_RW(Vec<ModelPatchNode*>, patches, getModelPatchNodes)
@@ -41,4 +44,11 @@ class ModelNode: public SceneNode
 };
 };
 
 
 
 
+inline bool ModelNode::classof(const SceneNode* x)
+{
+	return x->getClassId() == CID_MODEL_NODE ||
+		x->getClassId() == CID_PARTICLE;
+}
+
+
 #endif
 #endif

+ 2 - 3
src/scene/ModelPatchNode.cpp

@@ -10,9 +10,8 @@
 //==============================================================================
 //==============================================================================
 // Constructor                                                                 =
 // Constructor                                                                 =
 //==============================================================================
 //==============================================================================
-ModelPatchNode::ModelPatchNode(const ModelPatch& modelPatch_,
-	ModelNode* parent)
-:	PatchNode(modelPatch_, parent)
+ModelPatchNode::ModelPatchNode(const ModelPatch& modelPatch, ModelNode& parent)
+:	PatchNode(CID_MODEL_PATCH_NODE, modelPatch, SNF_NONE, parent)
 {
 {
 	VboArray vboArr;
 	VboArray vboArr;
 
 

+ 9 - 1
src/scene/ModelPatchNode.h

@@ -12,7 +12,9 @@ class ModelNode;
 class ModelPatchNode: public PatchNode
 class ModelPatchNode: public PatchNode
 {
 {
 	public:
 	public:
-		ModelPatchNode(const ModelPatch& modelPatch, ModelNode* parent);
+		ModelPatchNode(const ModelPatch& modelPatch, ModelNode& parent);
+
+		static bool classof(const SceneNode* x);
 
 
 		GETTER_R(Obb, visibilityShapeWSpace, getVisibilityShapeWSpace)
 		GETTER_R(Obb, visibilityShapeWSpace, getVisibilityShapeWSpace)
 
 
@@ -23,4 +25,10 @@ class ModelPatchNode: public PatchNode
 };
 };
 
 
 
 
+inline bool ModelPatchNode::classof(const SceneNode* x)
+{
+	return x->getClassId() == CID_MODEL_PATCH_NODE;
+}
+
+
 #endif
 #endif

+ 4 - 2
src/scene/PatchNode.cpp

@@ -6,8 +6,10 @@
 //==============================================================================
 //==============================================================================
 // Constructor                                                                 =
 // Constructor                                                                 =
 //==============================================================================
 //==============================================================================
-PatchNode::PatchNode(const ModelPatch& modelPatch, SceneNode* parent)
-:	RenderableNode(true, parent),
+PatchNode::PatchNode(ClassId cid, const ModelPatch& modelPatch, ulong flags,
+	SceneNode& parent)
+:	RenderableNode(cid, parent.getScene(), flags | SNF_INHERIT_PARENT_TRANSFORM,
+		&parent),
 	rsrc(modelPatch),
 	rsrc(modelPatch),
 	mtlRun(new MaterialRuntime(rsrc.getMaterial()))
 	mtlRun(new MaterialRuntime(rsrc.getMaterial()))
 {}
 {}

+ 11 - 3
src/scene/PatchNode.h

@@ -22,10 +22,10 @@ class PatchNode: public RenderableNode
 	public:
 	public:
 		typedef boost::array<const Vbo*, Mesh::VBOS_NUM> VboArray;
 		typedef boost::array<const Vbo*, Mesh::VBOS_NUM> VboArray;
 
 
-		PatchNode(const ModelPatch& modelPatch, SceneNode* parent);
+		PatchNode(ClassId cid, const ModelPatch& modelPatch, ulong flags,
+			SceneNode& parent);
 
 
-		/// Do nothing
-		void init(const char*) {}
+		static bool classof(const SceneNode* x);
 
 
 		/// @name Accessors
 		/// @name Accessors
 		/// @{
 		/// @{
@@ -66,4 +66,12 @@ class PatchNode: public RenderableNode
 };
 };
 
 
 
 
+inline bool PatchNode::classof(const SceneNode* x)
+{
+	return x->getClassId() == CID_PATCH_NODE ||
+		x->getClassId() == CID_MODEL_PATCH_NODE ||
+		x->getClassId() == CID_SKIN_PATCH_NODE;
+}
+
+
 #endif
 #endif

+ 2 - 5
src/scene/RenderableNode.cpp

@@ -1,12 +1,9 @@
 #include "RenderableNode.h"
 #include "RenderableNode.h"
 
 
 
 
-//==============================================================================
-// Constructor                                                                 =
-//==============================================================================
-RenderableNode::RenderableNode(bool inheritParentTrfFlag,
+RenderableNode::RenderableNode(ClassId cid, Scene& scene, ulong flags,
 	SceneNode* parent)
 	SceneNode* parent)
-:	SceneNode(SNT_RENDERABLE, inheritParentTrfFlag, parent)
+:	SceneNode(cid, scene, flags, parent)
 {}
 {}
 
 
 
 

+ 13 - 1
src/scene/RenderableNode.h

@@ -15,9 +15,12 @@ class MaterialRuntime;
 class RenderableNode: public SceneNode
 class RenderableNode: public SceneNode
 {
 {
 	public:
 	public:
-		RenderableNode(bool inheritParentTrfFlag, SceneNode* parent);
+		RenderableNode(ClassId cid, Scene& scene, ulong flags,
+			SceneNode* parent);
 		virtual ~RenderableNode();
 		virtual ~RenderableNode();
 
 
+		static bool classof(const SceneNode* x);
+
 		/// Get VAO depending the rendering pass
 		/// Get VAO depending the rendering pass
 		virtual const Vao& getVao(PassType p) const = 0;
 		virtual const Vao& getVao(PassType p) const = 0;
 
 
@@ -35,4 +38,13 @@ class RenderableNode: public SceneNode
 };
 };
 
 
 
 
+inline bool RenderableNode::classof(const SceneNode* x)
+{
+	return x->getClassId() == CID_RENDERABLE_NODE ||
+		x->getClassId() == CID_PATCH_NODE ||
+		x->getClassId() == CID_MODEL_PATCH_NODE ||
+		x->getClassId() == CID_SKIN_PATCH_NODE;
+}
+
+
 #endif
 #endif

+ 1 - 0
src/scene/SceneNode.h

@@ -71,6 +71,7 @@ class SceneNode
 		/// @name Accessors
 		/// @name Accessors
 		/// @{
 		/// @{
 		GETTER_R_BY_VAL(ClassId, cid, getClassId)
 		GETTER_R_BY_VAL(ClassId, cid, getClassId)
+		GETTER_RW(Scene, scene, getScene)
 		GETTER_SETTER(Transform, lTrf, getLocalTransform, setLocalTransform)
 		GETTER_SETTER(Transform, lTrf, getLocalTransform, setLocalTransform)
 		GETTER_SETTER(Transform, wTrf, getWorldTransform, setWorldTransform)
 		GETTER_SETTER(Transform, wTrf, getWorldTransform, setWorldTransform)
 		GETTER_R(Transform, prevWTrf, getPrevWorldTransform)
 		GETTER_R(Transform, prevWTrf, getPrevWorldTransform)

+ 14 - 4
src/scene/SpotLight.h

@@ -2,15 +2,18 @@
 #define SPOT_LIGHT_H
 #define SPOT_LIGHT_H
 
 
 #include "Light.h"
 #include "Light.h"
-#include "PerspectiveCamera.h"
+//#include "PerspectiveCamera.h"
 
 
 
 
 /// Spot light
 /// Spot light
 class SpotLight: public Light
 class SpotLight: public Light
 {
 {
 	public:
 	public:
-		SpotLight(bool inheritParentTrfFlag, SceneNode* parent);
+		SpotLight(Scene& scene, ulong flags, SceneNode* parent);
 		~SpotLight() {}
 		~SpotLight() {}
+
+		static bool classof(const SceneNode* x);
+
 		void init(const char* filename);
 		void init(const char* filename);
 
 
 		/// @name Accessors
 		/// @name Accessors
@@ -31,9 +34,16 @@ class SpotLight: public Light
 };
 };
 
 
 
 
-inline SpotLight::SpotLight(bool inheritParentTrfFlag, SceneNode* parent)
-:	Light(LT_SPOT, inheritParentTrfFlag, parent)
+inline SpotLight::SpotLight(Scene& scene, ulong flags, SceneNode* parent)
+:	Light(CID_SPOT_LIGHT, scene, flags, parent)
 {}
 {}
 
 
 
 
+bool SpotLight::classof(const SceneNode* x)
+{
+	return x->getClassId() == CID_LIGHT &&
+		static_cast<const Light*>(x)->getClassId() == CID_SPOT_LIGHT;
+}
+
+
 #endif
 #endif