Panagiotis Christopoulos Charitos 13 سال پیش
والد
کامیت
3c06f0a14b
4فایلهای تغییر یافته به همراه25 افزوده شده و 9 حذف شده
  1. 14 6
      include/anki/scene/Scene.h
  2. 2 0
      include/anki/scene/SceneNode.h
  3. 2 2
      src/scene/Scene.cpp
  4. 7 1
      src/scene/Sector.cpp

+ 14 - 6
include/anki/scene/Scene.h

@@ -9,6 +9,7 @@
 #include "anki/util/Vector.h"
 #include "anki/core/Timestamp.h"
 #include "anki/physics/PhysWorld.h"
+#include "anki/scene/Common.h"
 
 namespace anki {
 
@@ -26,7 +27,7 @@ public:
 	template<typename T>
 	struct Types
 	{
-		typedef Vector<T*> Container;
+		typedef SceneVector<T*> Container;
 		typedef typename Container::iterator Iterator;
 		typedef typename Container::const_iterator ConstIterator;
 		typedef typename ConstCharPtrHashMap<T*>::Type NameToItemMap;
@@ -44,12 +45,18 @@ public:
 	/// @name Accessors
 	/// @{
 
-	/// Return a copy
+	/// @note Return a copy
 	SceneAllocator<U8> getAllocator() const
 	{
 		return SceneAllocator<U8>(alloc);
 	}
 
+	/// @note Return a copy
+	SceneAllocator<U8> getFrameAllocator() const
+	{
+		return SceneAllocator<U8>(frameAlloc);
+	}
+
 	const Vec3& getAmbientColor() const
 	{
 		return ambientCol;
@@ -114,7 +121,7 @@ public:
 	}
 	/// @}
 
-	void update(float prevUpdateTime, float crntTime, Renderer& renderer);
+	void update(F32 prevUpdateTime, F32 crntTime, Renderer& renderer);
 
 	SceneNode& findSceneNode(const char* name);
 	SceneNode* tryFindSceneNode(const char* name);
@@ -123,15 +130,16 @@ public:
 
 private:
 	SceneAllocator<U8> alloc;
+	SceneAllocator<U8> frameAlloc;
+
+	Types<SceneNode>::Container nodes;
+	Types<SceneNode>::NameToItemMap nameToNode;
 
 	Vec3 ambientCol = Vec3(1.0); ///< The global ambient color
 	U32 ambiendColorUpdateTimestamp = Timestamp::getTimestamp();
 	Camera* mainCam = nullptr;
 	U32 activeCameraChangeTimestamp = Timestamp::getTimestamp();
 
-	Types<SceneNode>::Container nodes;
-	Types<SceneNode>::NameToItemMap nameToNode;
-
 	VisibilityTester vtester;
 	PhysWorld physics;
 

+ 2 - 0
include/anki/scene/SceneNode.h

@@ -51,6 +51,8 @@ public:
 	}
 
 	SceneAllocator<U8> getSceneAllocator() const;
+
+	SceneAllocator<U8> getSceneFrameAllocator() const;
 	/// @}
 
 	/// @name Accessors of components

+ 2 - 2
src/scene/Scene.cpp

@@ -39,7 +39,7 @@ struct UpdateMovablesJob: ThreadJob
 
 //==============================================================================
 Scene::Scene()
-	: alloc(ALLOCATOR_SIZE)
+	: alloc(ALLOCATOR_SIZE), frameAlloc(ALLOCATOR_SIZE), nodes(alloc)
 {
 	ambientCol = Vec3(0.1, 0.05, 0.05) * 2;
 }
@@ -63,7 +63,7 @@ void Scene::unregisterNode(SceneNode* node)
 }
 
 //==============================================================================
-void Scene::update(float prevUpdateTime, float crntTime, Renderer& r)
+void Scene::update(F32 prevUpdateTime, F32 crntTime, Renderer& r)
 {
 	physics.update(prevUpdateTime, crntTime);
 

+ 7 - 1
src/scene/Sector.cpp

@@ -68,7 +68,13 @@ SectorGroup::~SectorGroup()
 //==============================================================================
 Bool SectorGroup::placeSceneNode(SceneNode* sp)
 {
-	// XXX
+	// Find the candidates first. Sectors overlap
+	SceneVector<Sector*> placeSectors(scene->getFrameAllocator());
+	for(Sector* sector : sectors)
+	{
+		
+	}
+
 	return false;
 }