Просмотр исходного кода

Fixed Windows build.
Some tweaks to component categories.
Documentation update.

Lasse Öörni 12 лет назад
Родитель
Сommit
2afdf2675a

+ 2 - 1
Docs/GettingStarted.dox

@@ -37,7 +37,8 @@ cmake_vs2008.bat, cmake_vs2010.bat or cmake_vs2012.bat on Windows,\n
 cmake_eclipse.sh on Linux,\n
 cmake_eclipse.sh on Linux,\n
 cmake_macosx.sh on Mac OS X, and\n
 cmake_macosx.sh on Mac OS X, and\n
 cmake_gcc.sh on both Linux and Mac OS X.
 cmake_gcc.sh on both Linux and Mac OS X.
--# For Visual Studio, open Urho3D.sln and build the configuration(s) you like. On Windows, using other compilers than Visual Studio is not officially supported. MinGW may work (cmake -G "MinGW Makefiles"), but may lack required DirectX headers. They can be copied to a MinGW installation from the following package: http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz.\n
+-# For Visual Studio, open Urho3D.sln and build the configuration(s) you like. When compiling as 64bit, you currently have to manually set the assembly source files (in AngelScript and LibCpuId projects) to compile using MASM. This is a CMake bug.\n
+On Windows, using other compilers than Visual Studio is not officially supported. MinGW may work (cmake -G "MinGW Makefiles"), but may lack required DirectX headers. They can be copied to a MinGW installation from the following package: http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz.\n
 For Eclipse on Linux, import the Eclipse's project(s) generated by CMake into the workspace. The Eclipse's projects are generated in "Urho3D-Eclipse-build" sub-directory sibling to Urho3D project directory. See "Importing existing projects" in Eclipse Help for detail steps. Select "Build All" or "Build Project" in the menu. Note that Eclipse requires CDT plugin to build C/C++ project.\n
 For Eclipse on Linux, import the Eclipse's project(s) generated by CMake into the workspace. The Eclipse's projects are generated in "Urho3D-Eclipse-build" sub-directory sibling to Urho3D project directory. See "Importing existing projects" in Eclipse Help for detail steps. Select "Build All" or "Build Project" in the menu. Note that Eclipse requires CDT plugin to build C/C++ project.\n
 For GCC, execute make (by default, cmake_gcc.sh specifies to make a RelWithDebInfo build).\n
 For GCC, execute make (by default, cmake_gcc.sh specifies to make a RelWithDebInfo build).\n
 For Xcode on Mac OS X, open Urho3D.xcodeproj and build.
 For Xcode on Mac OS X, open Urho3D.xcodeproj and build.

+ 0 - 2
Engine/Audio/Audio.h

@@ -30,8 +30,6 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-extern const char* AUDIO_CATEGORY;
-
 class AudioImpl;
 class AudioImpl;
 class Sound;
 class Sound;
 class SoundListener;
 class SoundListener;

+ 2 - 0
Engine/Audio/SoundSource.cpp

@@ -101,6 +101,8 @@ static const char* typeNames[] =
 
 
 static const float AUTOREMOVE_DELAY = 0.25f;
 static const float AUTOREMOVE_DELAY = 0.25f;
 
 
+extern const char* AUDIO_CATEGORY;
+
 OBJECTTYPESTATIC(SoundSource);
 OBJECTTYPESTATIC(SoundSource);
 
 
 SoundSource::SoundSource(Context* context) :
 SoundSource::SoundSource(Context* context) :

+ 2 - 0
Engine/Audio/SoundSource3D.cpp

@@ -38,6 +38,8 @@ static const float DEFAULT_FARDISTANCE = 100.0f;
 static const float DEFAULT_ROLLOFF = 2.0f;
 static const float DEFAULT_ROLLOFF = 2.0f;
 static const float MIN_ROLLOFF = 0.1f;
 static const float MIN_ROLLOFF = 0.1f;
 
 
+extern const char* AUDIO_CATEGORY;
+
 OBJECTTYPESTATIC(SoundSource3D);
 OBJECTTYPESTATIC(SoundSource3D);
 
 
 SoundSource3D::SoundSource3D(Context* context) :
 SoundSource3D::SoundSource3D(Context* context) :

+ 2 - 1
Engine/Core/Context.cpp

@@ -85,7 +85,8 @@ void Context::RegisterFactory(ObjectFactory* factory)
 void Context::RegisterComponentFactory(ObjectFactory* factory, const char* category)
 void Context::RegisterComponentFactory(ObjectFactory* factory, const char* category)
 {
 {
     RegisterFactory(factory);
     RegisterFactory(factory);
-    componentCategories_[category].Push(factory->GetType());
+    if (String::CStringLength(category))
+        componentCategories_[category].Push(factory->GetType());
 }
 }
 
 
 void Context::RegisterSubsystem(Object* object)
 void Context::RegisterSubsystem(Object* object)

+ 1 - 1
Engine/Engine/APITemplates.h

@@ -399,7 +399,7 @@ template <class T> void RegisterComponent(asIScriptEngine* engine, const char* c
     engine->RegisterObjectMethod(className, "bool get_enabled() const", asMETHODPR(T, IsEnabled, () const, bool), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool get_enabled() const", asMETHODPR(T, IsEnabled, () const, bool), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool get_enabledEffective() const", asMETHODPR(T, IsEnabledEffective, () const, bool), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "bool get_enabledEffective() const", asMETHODPR(T, IsEnabledEffective, () const, bool), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "uint get_id()", asMETHODPR(T, GetID, () const, unsigned), asCALL_THISCALL);
     engine->RegisterObjectMethod(className, "uint get_id()", asMETHODPR(T, GetID, () const, unsigned), asCALL_THISCALL);
-    engine->RegisterObjectMethod(className, "const String& get_category() const", asMETHOD(T, GetCategory), asCALL_THISCALL);
+    engine->RegisterObjectMethod(className, "const String& get_category() const", asMETHODPR(T, GetCategory, () const, const String&), asCALL_THISCALL);
     if (nodeRegistered)
     if (nodeRegistered)
         engine->RegisterObjectMethod(className, "Node@+ get_node() const", asMETHODPR(T, GetNode, () const, Node*), asCALL_THISCALL);
         engine->RegisterObjectMethod(className, "Node@+ get_node() const", asMETHODPR(T, GetNode, () const, Node*), asCALL_THISCALL);
     if (debugRendererRegistered)
     if (debugRendererRegistered)

+ 2 - 0
Engine/Graphics/AnimatedModel.cpp

@@ -47,6 +47,8 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
+extern const char* ANIMATION_CATEGORY;
+
 static bool CompareAnimationOrder(const SharedPtr<AnimationState>& lhs, const SharedPtr<AnimationState>& rhs)
 static bool CompareAnimationOrder(const SharedPtr<AnimationState>& lhs, const SharedPtr<AnimationState>& rhs)
 {
 {
     return lhs->GetLayer() < rhs->GetLayer();
     return lhs->GetLayer() < rhs->GetLayer();

+ 0 - 2
Engine/Graphics/Animation.h

@@ -30,8 +30,6 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-extern const char* ANIMATION_CATEGORY;
-
 /// Skeletal animation keyframe.
 /// Skeletal animation keyframe.
 struct AnimationKeyFrame
 struct AnimationKeyFrame
 {
 {

+ 2 - 0
Engine/Graphics/AnimationController.cpp

@@ -46,6 +46,8 @@ static const unsigned char CTRL_SETWEIGHT = 0x10;
 static const float EXTRA_ANIM_FADEOUT_TIME = 0.1f;
 static const float EXTRA_ANIM_FADEOUT_TIME = 0.1f;
 static const float COMMAND_STAY_TIME = 0.25f;
 static const float COMMAND_STAY_TIME = 0.25f;
 
 
+extern const char* ANIMATION_CATEGORY;
+
 OBJECTTYPESTATIC(AnimationController);
 OBJECTTYPESTATIC(AnimationController);
 
 
 AnimationController::AnimationController(Context* context) :
 AnimationController::AnimationController(Context* context) :

+ 1 - 1
Engine/Graphics/BillboardSet.cpp

@@ -41,7 +41,7 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-extern const char* EFFECT_CATEGORY;
+const char* EFFECT_CATEGORY = "Effect";
 
 
 static const float INV_SQRT_TWO = 1.0f / sqrtf(2.0f);
 static const float INV_SQRT_TWO = 1.0f / sqrtf(2.0f);
 
 

+ 2 - 2
Engine/Graphics/DebugRenderer.cpp

@@ -41,7 +41,7 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-extern const char* SCENE_CATEGORY;
+extern const char* SUBSYSTEM_CATEGORY;
 
 
 // Cap the amount of lines to prevent crash when eg. debug rendering large heightfields
 // Cap the amount of lines to prevent crash when eg. debug rendering large heightfields
 static const unsigned MAX_LINES = 1000000;
 static const unsigned MAX_LINES = 1000000;
@@ -62,7 +62,7 @@ DebugRenderer::~DebugRenderer()
 
 
 void DebugRenderer::RegisterObject(Context* context)
 void DebugRenderer::RegisterObject(Context* context)
 {
 {
-    context->RegisterComponentFactory<DebugRenderer>(SCENE_CATEGORY);
+    context->RegisterComponentFactory<DebugRenderer>(SUBSYSTEM_CATEGORY);
 }
 }
 
 
 void DebugRenderer::SetView(Camera* camera)
 void DebugRenderer::SetView(Camera* camera)

+ 2 - 0
Engine/Graphics/DecalSet.cpp

@@ -55,6 +55,8 @@ static const unsigned STATIC_ELEMENT_MASK = MASK_POSITION | MASK_NORMAL | MASK_T
 static const unsigned SKINNED_ELEMENT_MASK = MASK_POSITION | MASK_NORMAL | MASK_TEXCOORD1 | MASK_TANGENT | MASK_BLENDWEIGHTS |
 static const unsigned SKINNED_ELEMENT_MASK = MASK_POSITION | MASK_NORMAL | MASK_TEXCOORD1 | MASK_TANGENT | MASK_BLENDWEIGHTS |
     MASK_BLENDINDICES;
     MASK_BLENDINDICES;
 
 
+extern const char* EFFECT_CATEGORY;
+
 static DecalVertex ClipEdge(const DecalVertex& v0, const DecalVertex& v1, float d0, float d1, bool skinned)
 static DecalVertex ClipEdge(const DecalVertex& v0, const DecalVertex& v1, float d0, float d1, bool skinned)
 {
 {
     DecalVertex ret;
     DecalVertex ret;

+ 3 - 1
Engine/Graphics/Octree.cpp

@@ -45,6 +45,8 @@ static const float DEFAULT_OCTREE_SIZE = 1000.0f;
 static const int DEFAULT_OCTREE_LEVELS = 8;
 static const int DEFAULT_OCTREE_LEVELS = 8;
 static const int RAYCASTS_PER_WORK_ITEM = 4;
 static const int RAYCASTS_PER_WORK_ITEM = 4;
 
 
+extern const char* SUBSYSTEM_CATEGORY;
+
 void RaycastDrawablesWork(const WorkItem* item, unsigned threadIndex)
 void RaycastDrawablesWork(const WorkItem* item, unsigned threadIndex)
 {
 {
     Octree* octree = reinterpret_cast<Octree*>(item->aux_);
     Octree* octree = reinterpret_cast<Octree*>(item->aux_);
@@ -348,7 +350,7 @@ Octree::~Octree()
 
 
 void Octree::RegisterObject(Context* context)
 void Octree::RegisterObject(Context* context)
 {
 {
-    context->RegisterComponentFactory<Octree>(SCENE_CATEGORY);
+    context->RegisterComponentFactory<Octree>(SUBSYSTEM_CATEGORY);
 
 
     Vector3 defaultBoundsMin = -Vector3::ONE * DEFAULT_OCTREE_SIZE;
     Vector3 defaultBoundsMin = -Vector3::ONE * DEFAULT_OCTREE_SIZE;
     Vector3 defaultBoundsMax = Vector3::ONE * DEFAULT_OCTREE_SIZE;
     Vector3 defaultBoundsMax = Vector3::ONE * DEFAULT_OCTREE_SIZE;

+ 2 - 0
Engine/Graphics/ParticleEmitter.cpp

@@ -36,6 +36,8 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
+extern const char* EFFECT_CATEGORY;
+
 OBJECTTYPESTATIC(ParticleEmitter);
 OBJECTTYPESTATIC(ParticleEmitter);
 
 
 ParticleEmitter::ParticleEmitter(Context* context) :
 ParticleEmitter::ParticleEmitter(Context* context) :

+ 2 - 2
Engine/Graphics/Skybox.cpp

@@ -32,7 +32,7 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-static const char* SKY_CATEGORY = "Sky";
+const char* ENVIRONMENT_CATEGORY = "Environment";
 
 
 OBJECTTYPESTATIC(Skybox);
 OBJECTTYPESTATIC(Skybox);
 
 
@@ -48,7 +48,7 @@ Skybox::~Skybox()
 
 
 void Skybox::RegisterObject(Context* context)
 void Skybox::RegisterObject(Context* context)
 {
 {
-    context->RegisterComponentFactory<Skybox>(SKY_CATEGORY);
+    context->RegisterComponentFactory<Skybox>(ENVIRONMENT_CATEGORY);
 
 
     COPY_BASE_ATTRIBUTES(Skybox, StaticModel);
     COPY_BASE_ATTRIBUTES(Skybox, StaticModel);
 }
 }

+ 2 - 2
Engine/Graphics/Terrain.cpp

@@ -44,7 +44,7 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-const char* TERRAIN_CATEGORY = "Terrain";
+extern const char* ENVIRONMENT_CATEGORY;
 
 
 OBJECTTYPESTATIC(Terrain);
 OBJECTTYPESTATIC(Terrain);
 
 
@@ -91,7 +91,7 @@ Terrain::~Terrain()
 
 
 void Terrain::RegisterObject(Context* context)
 void Terrain::RegisterObject(Context* context)
 {
 {
-    context->RegisterComponentFactory<Terrain>(TERRAIN_CATEGORY);
+    context->RegisterComponentFactory<Terrain>(ENVIRONMENT_CATEGORY);
 
 
     ACCESSOR_ATTRIBUTE(Terrain, VAR_BOOL, "Is Enabled", IsEnabled, SetEnabled, bool, true, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(Terrain, VAR_BOOL, "Is Enabled", IsEnabled, SetEnabled, bool, true, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(Terrain, VAR_RESOURCEREF, "Height Map", GetHeightMapAttr, SetHeightMapAttr, ResourceRef, ResourceRef(Image::GetTypeStatic()), AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(Terrain, VAR_RESOURCEREF, "Height Map", GetHeightMapAttr, SetHeightMapAttr, ResourceRef, ResourceRef(Image::GetTypeStatic()), AM_DEFAULT);

+ 0 - 2
Engine/Graphics/Terrain.h

@@ -27,8 +27,6 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-extern const char* TERRAIN_CATEGORY;
-
 class Image;
 class Image;
 class Material;
 class Material;
 class Node;
 class Node;

+ 3 - 1
Engine/Graphics/TerrainPatch.cpp

@@ -41,6 +41,8 @@ namespace Urho3D
 
 
 static const float LOD_CONSTANT = 1.0f / 150.0f;
 static const float LOD_CONSTANT = 1.0f / 150.0f;
 
 
+extern const char* ENVIRONMENT_CATEGORY;
+
 OBJECTTYPESTATIC(TerrainPatch);
 OBJECTTYPESTATIC(TerrainPatch);
 
 
 TerrainPatch::TerrainPatch(Context* context) :
 TerrainPatch::TerrainPatch(Context* context) :
@@ -68,7 +70,7 @@ TerrainPatch::~TerrainPatch()
 
 
 void TerrainPatch::RegisterObject(Context* context)
 void TerrainPatch::RegisterObject(Context* context)
 {
 {
-    context->RegisterComponentFactory<TerrainPatch>(TERRAIN_CATEGORY);
+    context->RegisterComponentFactory<TerrainPatch>(ENVIRONMENT_CATEGORY);
 }
 }
 
 
 void TerrainPatch::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)
 void TerrainPatch::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQueryResult>& results)

+ 2 - 0
Engine/Graphics/Zone.cpp

@@ -40,6 +40,8 @@ static const Color DEFAULT_FOG_COLOR(0.0f, 0.0f, 0.0f);
 static const float DEFAULT_FOG_START = 250.0f;
 static const float DEFAULT_FOG_START = 250.0f;
 static const float DEFAULT_FOG_END = 1000.0f;
 static const float DEFAULT_FOG_END = 1000.0f;
 
 
+extern const char* SCENE_CATEGORY;
+
 OBJECTTYPESTATIC(Zone);
 OBJECTTYPESTATIC(Zone);
 
 
 Zone::Zone(Context* context) :
 Zone::Zone(Context* context) :

+ 0 - 2
Engine/Navigation/Navigation.h

@@ -25,8 +25,6 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-extern const char* NAVIGATION_CATEGORY;
-
 class Context;
 class Context;
 
 
 /// Register Navigation library objects.
 /// Register Navigation library objects.

+ 2 - 0
Engine/Physics/CollisionShape.cpp

@@ -72,6 +72,8 @@ static const char* typeNames[] =
     0
     0
 };
 };
 
 
+extern const char* PHYSICS_CATEGORY;
+
 TriangleMeshData::TriangleMeshData(Model* model, unsigned lodLevel) :
 TriangleMeshData::TriangleMeshData(Model* model, unsigned lodLevel) :
     meshData_(0),
     meshData_(0),
     shape_(0)
     shape_(0)

+ 2 - 0
Engine/Physics/Constraint.cpp

@@ -51,6 +51,8 @@ static const char* typeNames[] =
     0
     0
 };
 };
 
 
+extern const char* PHYSICS_CATEGORY;
+
 OBJECTTYPESTATIC(Constraint);
 OBJECTTYPESTATIC(Constraint);
 
 
 Constraint::Constraint(Context* context) :
 Constraint::Constraint(Context* context) :

+ 2 - 1
Engine/Physics/PhysicsWorld.cpp

@@ -48,6 +48,7 @@ namespace Urho3D
 {
 {
 
 
 const char* PHYSICS_CATEGORY = "Physics";
 const char* PHYSICS_CATEGORY = "Physics";
+extern const char* SUBSYSTEM_CATEGORY;
 
 
 static const int DEFAULT_FPS = 60;
 static const int DEFAULT_FPS = 60;
 static const Vector3 DEFAULT_GRAVITY = Vector3(0.0f, -9.81f, 0.0f);
 static const Vector3 DEFAULT_GRAVITY = Vector3(0.0f, -9.81f, 0.0f);
@@ -154,7 +155,7 @@ PhysicsWorld::~PhysicsWorld()
 
 
 void PhysicsWorld::RegisterObject(Context* context)
 void PhysicsWorld::RegisterObject(Context* context)
 {
 {
-    context->RegisterComponentFactory<PhysicsWorld>(PHYSICS_CATEGORY);
+    context->RegisterComponentFactory<PhysicsWorld>(SUBSYSTEM_CATEGORY);
 
 
     ACCESSOR_ATTRIBUTE(PhysicsWorld, VAR_VECTOR3, "Gravity", GetGravity, SetGravity, Vector3, DEFAULT_GRAVITY, AM_DEFAULT);
     ACCESSOR_ATTRIBUTE(PhysicsWorld, VAR_VECTOR3, "Gravity", GetGravity, SetGravity, Vector3, DEFAULT_GRAVITY, AM_DEFAULT);
     ATTRIBUTE(PhysicsWorld, VAR_INT, "Physics FPS", fps_, DEFAULT_FPS, AM_DEFAULT);
     ATTRIBUTE(PhysicsWorld, VAR_INT, "Physics FPS", fps_, DEFAULT_FPS, AM_DEFAULT);

+ 0 - 2
Engine/Physics/PhysicsWorld.h

@@ -39,8 +39,6 @@ class btPersistentManifold;
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-extern const char* PHYSICS_CATEGORY;
-
 class CollisionShape;
 class CollisionShape;
 class Deserializer;
 class Deserializer;
 class Constraint;
 class Constraint;

+ 2 - 0
Engine/Physics/RigidBody.cpp

@@ -57,6 +57,8 @@ static const char* collisionEventModeNames[] =
     0
     0
 };
 };
 
 
+extern const char* PHYSICS_CATEGORY;
+
 OBJECTTYPESTATIC(RigidBody);
 OBJECTTYPESTATIC(RigidBody);
 
 
 RigidBody::RigidBody(Context* context) :
 RigidBody::RigidBody(Context* context) :

+ 1 - 1
Engine/Scene/Scene.cpp

@@ -41,7 +41,7 @@ namespace Urho3D
 {
 {
 
 
 const char* SCENE_CATEGORY = "Scene";
 const char* SCENE_CATEGORY = "Scene";
-const char* EFFECT_CATEGORY = "Effect";
+const char* SUBSYSTEM_CATEGORY = "Subsystem";
 
 
 static const int ASYNC_LOAD_MIN_FPS = 30;
 static const int ASYNC_LOAD_MIN_FPS = 30;
 static const int ASYNC_LOAD_MAX_MSEC = (int)(1000.0f / ASYNC_LOAD_MIN_FPS);
 static const int ASYNC_LOAD_MAX_MSEC = (int)(1000.0f / ASYNC_LOAD_MIN_FPS);

+ 0 - 3
Engine/Scene/Scene.h

@@ -31,9 +31,6 @@
 namespace Urho3D
 namespace Urho3D
 {
 {
 
 
-extern const char* SCENE_CATEGORY;
-extern const char* EFFECT_CATEGORY;
-
 class File;
 class File;
 class PackageFile;
 class PackageFile;
 
 

+ 4 - 1
Readme.txt

@@ -145,10 +145,13 @@ cmake_macosx.sh on Mac OS X, and
 cmake_gcc.sh on both Linux and Mac OS X.
 cmake_gcc.sh on both Linux and Mac OS X.
 
 
 2) For Visual Studio, open Urho3D.sln and build the configuration(s) you like.
 2) For Visual Studio, open Urho3D.sln and build the configuration(s) you like.
+When compiling as 64bit on Visual Studio, you currently have to manually set
+the assembly source files (in AngelScript and LibCpuId projects) to compile 
+using MASM. This is a CMake bug.
 
 
 On Windows, using other compilers than Visual Studio is not officially
 On Windows, using other compilers than Visual Studio is not officially
 supported. MinGW may work (cmake -G "MinGW Makefiles"), but may lack required
 supported. MinGW may work (cmake -G "MinGW Makefiles"), but may lack required
-DirectX headers. They can be copied to a MinGW installation from the following 
+DirectX headers. They can be copied to a MinGW installation from the following
 package: http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz
 package: http://www.libsdl.org/extras/win32/common/directx-devel.tar.gz
 
 
 For Eclipse on Linux, import the Eclipse's project(s) generated by CMake into
 For Eclipse on Linux, import the Eclipse's project(s) generated by CMake into