Переглянути джерело

Merge pull request #985 from dgough/next

Updated encoder usage text
Sean Paul Taylor 12 роки тому
батько
коміт
45584c1cce

+ 4 - 3
CMakeLists.txt

@@ -24,6 +24,7 @@ add_subdirectory(gameplay)
 # gameplay samples
 add_subdirectory(samples)
 
-
-
-
+# gameplay encoder
+# A pre-compiled executable can be found in 'gameplay/bin'
+# Uncomment out this line if you want to build the encoder instead of using the pre-compiled gameplay-encoder.
+#add_subdirectory(tools/encoder)

+ 1 - 1
gameplay/src/PlatformAndroid.cpp

@@ -810,7 +810,7 @@ static int32_t engine_handle_input(struct android_app* app, AInputEvent* event)
                             gameplay::Game::getInstance()->getAbsoluteTime() - __pointer1.time < GESTURE_SWIPE_DURATION_MAX && 
                             (abs(deltaX) > GESTURE_SWIPE_DISTANCE_MIN || abs(deltaY) > GESTURE_SWIPE_DISTANCE_MIN) )
                         {
-                            int direction;
+                            int direction = 0;
                             if (deltaX > 0)
                                 direction |= gameplay::Gesture::SWIPE_DIRECTION_RIGHT;
                             else if (deltaX < 0)

+ 1 - 1
gameplay/src/ScriptController.cpp

@@ -99,7 +99,7 @@ static bool getNestedVariable(lua_State* lua, const char* name)
     {
         start = end;
         end = strchr(start, '.');
-        if (end == '\0' || end == NULL)
+        if (end == NULL || *end == '\0')
         {
             // push the last variable
             lua_pushstring(lua, start);

+ 1 - 1
samples/browser/CMakeLists.txt

@@ -53,7 +53,7 @@ set(GAME_SRC
     src/BillboardSample.cpp
     src/BillboardSample.h
     src/CreateSceneSample.cpp
-    src/CreateSceneSample.h	
+    src/CreateSceneSample.h    
     src/CreateSceneSample.h
     src/FirstPersonCamera.cpp
     src/FirstPersonCamera.h

+ 2 - 2
samples/character/CMakeLists.txt

@@ -1,8 +1,8 @@
 set(GAME_NAME sample-character)
 
 set(GAME_SRC
-	src/CharacterGame.cpp
-	src/CharacterGame.h
+    src/CharacterGame.cpp
+    src/CharacterGame.h
 )
 
 add_executable(${GAME_NAME}

+ 2 - 2
samples/longboard/CMakeLists.txt

@@ -1,8 +1,8 @@
 set( GAME_NAME sample-longboard )
 
 set(GAME_SRC
-	src/LongboardGame.cpp
-	src/LongboardGame.h
+    src/LongboardGame.cpp
+    src/LongboardGame.h
 )
 
 add_executable(${GAME_NAME}

+ 2 - 2
samples/lua/CMakeLists.txt

@@ -1,8 +1,8 @@
 set(GAME_NAME sample-lua)
 
 set(GAME_SRC
-	src/LuaGame.cpp
-	src/LuaGame.h
+    src/LuaGame.cpp
+    src/LuaGame.h
 )
 
 add_executable(${GAME_NAME}

+ 2 - 2
samples/mesh/CMakeLists.txt

@@ -1,8 +1,8 @@
 set( GAME_NAME sample-mesh )
 
 set(GAME_SRC
-	src/MeshGame.cpp
-	src/MeshGame.h
+    src/MeshGame.cpp
+    src/MeshGame.h
 )
 
 add_executable(${GAME_NAME}

+ 2 - 2
samples/particles/CMakeLists.txt

@@ -1,8 +1,8 @@
 set(GAME_NAME sample-particles)
 
 set(GAME_SRC
-	src/ParticlesGame.cpp
-	src/ParticlesGame.h
+    src/ParticlesGame.cpp
+    src/ParticlesGame.h
 )
 
 add_executable(${GAME_NAME}

+ 2 - 2
samples/racer/CMakeLists.txt

@@ -1,8 +1,8 @@
 set(GAME_NAME sample-racer)
 
 set(GAME_SRC
-	src/RacerGame.cpp
-	src/RacerGame.h
+    src/RacerGame.cpp
+    src/RacerGame.h
 )
 
 add_executable(${GAME_NAME}

+ 2 - 2
samples/spaceship/CMakeLists.txt

@@ -1,8 +1,8 @@
 set(GAME_NAME sample-spaceship)
 
 set(GAME_SRC
-	src/SpaceshipGame.cpp
-	src/SpaceshipGame.h
+    src/SpaceshipGame.cpp
+    src/SpaceshipGame.h
 )
 
 add_executable(${GAME_NAME}

+ 93 - 93
tools/encoder/CMakeLists.txt

@@ -32,101 +32,101 @@ add_definitions(-lstdc++ -ldl -lfbxsdk-2013.3-static -lpng -lz -lfreetype -lpthr
 set( APP_NAME gameplay-encoder )
 
 set(APP_SRC
-	src/AnimationChannel.cpp
-	src/AnimationChannel.h
-	src/Animation.cpp
-	src/Animation.h
-	src/Animations.cpp
-	src/Animations.h
-	src/Base.cpp
-	src/Base.h
-	src/BoundingVolume.cpp
-	src/BoundingVolume.h
-	src/Camera.cpp
-	src/Camera.h
+    src/AnimationChannel.cpp
+    src/AnimationChannel.h
+    src/Animation.cpp
+    src/Animation.h
+    src/Animations.cpp
+    src/Animations.h
+    src/Base.cpp
+    src/Base.h
+    src/BoundingVolume.cpp
+    src/BoundingVolume.h
+    src/Camera.cpp
+    src/Camera.h
     src/Constants.cpp
     src/Constants.h
-	src/Curve.cpp
-	src/Curve.h
-	src/Curve.inl
-	src/Effect.cpp
-	src/Effect.h
-	src/EncoderArguments.cpp
-	src/EncoderArguments.h
-	src/FBXSceneEncoder.cpp
-	src/FBXSceneEncoder.h
-	src/FBXUtil.cpp
-	src/FBXUtil.h
-	src/FileIO.cpp
-	src/FileIO.h
-	src/Font.cpp
-	src/Font.h
-	src/Glyph.cpp
-	src/Glyph.h
-	src/GPBDecoder.cpp
-	src/GPBDecoder.h
-	src/GPBFile.cpp
-	src/GPBFile.h
-	src/Heightmap.cpp
-	src/Heightmap.h
-	src/Image.cpp
-	src/Image.h
-	src/Light.cpp
-	src/Light.h
-	src/main.cpp
-	src/Material.cpp
-	src/Material.h
-	src/MaterialParameter.cpp
-	src/MaterialParameter.h
-	src/Matrix.cpp
-	src/Matrix.h
-	src/Mesh.cpp
-	src/Mesh.h
-	src/MeshPart.cpp
-	src/MeshPart.h
-	src/MeshSkin.cpp
-	src/MeshSkin.h
-	src/MeshSubSet.cpp
-	src/MeshSubSet.h
-	src/Model.cpp
-	src/Model.h
-	src/Node.cpp
-	src/Node.h
-	src/NormalMapGenerator.cpp
-	src/NormalMapGenerator.h
-	src/Object.cpp
-	src/Object.h
-	src/Quaternion.cpp
-	src/Quaternion.h
-	src/Quaternion.inl
-	src/Reference.cpp
-	src/Reference.h
-	src/ReferenceTable.cpp
-	src/ReferenceTable.h
-	src/Sampler.cpp
-	src/Sampler.h
-	src/Scene.cpp
-	src/Scene.h
-	src/StringUtil.cpp
-	src/StringUtil.h
-	src/Thread.h
-	src/Transform.cpp
-	src/Transform.h
-	src/TTFFontEncoder.cpp
-	src/TTFFontEncoder.h
-	src/Vector2.cpp
-	src/Vector2.h
-	src/Vector2.inl
-	src/Vector3.cpp
-	src/Vector3.h
-	src/Vector3.inl
-	src/Vector4.cpp
-	src/Vector4.h
-	src/Vector4.inl
-	src/Vertex.cpp
-	src/VertexElement.cpp
-	src/VertexElement.h
-	src/Vertex.h
+    src/Curve.cpp
+    src/Curve.h
+    src/Curve.inl
+    src/Effect.cpp
+    src/Effect.h
+    src/EncoderArguments.cpp
+    src/EncoderArguments.h
+    src/FBXSceneEncoder.cpp
+    src/FBXSceneEncoder.h
+    src/FBXUtil.cpp
+    src/FBXUtil.h
+    src/FileIO.cpp
+    src/FileIO.h
+    src/Font.cpp
+    src/Font.h
+    src/Glyph.cpp
+    src/Glyph.h
+    src/GPBDecoder.cpp
+    src/GPBDecoder.h
+    src/GPBFile.cpp
+    src/GPBFile.h
+    src/Heightmap.cpp
+    src/Heightmap.h
+    src/Image.cpp
+    src/Image.h
+    src/Light.cpp
+    src/Light.h
+    src/main.cpp
+    src/Material.cpp
+    src/Material.h
+    src/MaterialParameter.cpp
+    src/MaterialParameter.h
+    src/Matrix.cpp
+    src/Matrix.h
+    src/Mesh.cpp
+    src/Mesh.h
+    src/MeshPart.cpp
+    src/MeshPart.h
+    src/MeshSkin.cpp
+    src/MeshSkin.h
+    src/MeshSubSet.cpp
+    src/MeshSubSet.h
+    src/Model.cpp
+    src/Model.h
+    src/Node.cpp
+    src/Node.h
+    src/NormalMapGenerator.cpp
+    src/NormalMapGenerator.h
+    src/Object.cpp
+    src/Object.h
+    src/Quaternion.cpp
+    src/Quaternion.h
+    src/Quaternion.inl
+    src/Reference.cpp
+    src/Reference.h
+    src/ReferenceTable.cpp
+    src/ReferenceTable.h
+    src/Sampler.cpp
+    src/Sampler.h
+    src/Scene.cpp
+    src/Scene.h
+    src/StringUtil.cpp
+    src/StringUtil.h
+    src/Thread.h
+    src/Transform.cpp
+    src/Transform.h
+    src/TTFFontEncoder.cpp
+    src/TTFFontEncoder.h
+    src/Vector2.cpp
+    src/Vector2.h
+    src/Vector2.inl
+    src/Vector3.cpp
+    src/Vector3.h
+    src/Vector3.inl
+    src/Vector4.cpp
+    src/Vector4.h
+    src/Vector4.inl
+    src/Vertex.cpp
+    src/VertexElement.cpp
+    src/VertexElement.h
+    src/Vertex.h
 )
 
 add_executable(${APP_NAME}

+ 3 - 49
tools/encoder/README.md

@@ -26,60 +26,14 @@ Note: On Linux Ubuntu 12 (64-bit), you must first install the required 32-bit li
 `sudo apt-get install ia32-libs`
 
 ## Building gameplay-encoder
-The gameplay-encoder comes pre-built for Windows 7, MacOS X and Linux Ubuntu 12 (32-bit) in the 'bin' folder.
-However, to build the gameplay-encoder yourself just open either the 
-Visual Studio 2010 project "gameplay-encoder.vccproj" on Windows 7 or
-XCode project "gameplay-encoder.xcodeproj" on MacOSX.
-Uncomment the root CMakeList.txt for the gameplay-encoder and run standard cmake .. from build then make.
 
-### Building with FBX Support on Windows 7 using Visual Studio 2010
-- Download and install the FBX SDK for Window VS2010. (http://www.autodesk.com/fbx)
-- Edit the project properties of "gameplay-encoder" for Debug
-- Add Preprocessor Definition "USE_FBX" (C++/Preprocessor)
-- Add the FBX SDK include directory to Additional Include Directories (C++/General)
-  * Example: C:/Program Files/Autodesk/FBX/FBX SDK/2013.3/include
-- Add the FBX lib directory to the Additional Library Directories (Linker/General)
-  * Example: C:/Program Files/Autodesk/FBX/FBX SDK/2013.3/lib/vs2010/x86
-- Add "fbxsdk-2013.3-md.lib"(Release) to the Additional Dependencies (Linker/Input)
-  * Example: fbxsdk-2013.3-md.lib
-- Build gameplay-encoder
-
-### Building with FBX Support on MacOS X using XCode 4
-- Download and install the FBX SDK for MacOS X (http://www.autodesk.com/fbx)
-- Edit the project properties of target "gameplay-encoder".
-- Add Preprocessor Macro "USE_FBX" to both Debug/Release sections. (Build Settings)
-- Add the FBX include directory to Header Search Paths: (Build Settings)
-  * Example: "/Applications/Autodesk/FBX SDK/2013.3/include" (Use quotes due to additional space in path)
-- Add the FBX library and dependency Library/Frameworks: (Build Phases -> Link Binary with Libraries)
-  * Example: /Applications/Autodesk/FBX SDK/2013.3/lib/gcc4/ub/libfbxsdk-2013.3-static.a  (Add Other)
-- Build gameplay-encoder
-
-### Building with FBX Support on Linux Ubuntu 12 (32-bit) using CMake
-- Download and install the FBX SDK for MacOS X (http://www.autodesk.com/fbx)
-- Edit the gameplay-encoder/CMakeLists.txt adding the following:
-- Add the FBX include directory to Header Search Paths: (Build Settings)
-  * Example: /usr/include/fbxsdk
-- Add Preprocessor Macro to the add"-DUSE_FBX" to the end of the add_definitions(...) section of the CMakeLists.txt
-- Add the FBX library path to the link_directories(...) section of the CMakeLists.txt
-  * Example: /usr/lib/gcc4
-- Add the FBX library to the set(APP_LIBRARIES {...} )
-  * Example: fbxsdk-2013.3-static
-- Add the FBX library to the library to the add_definitions(-l...) section of the CMakeLists.txt
-  * Example -lfbxsdk-2013.3-static
-- Build gameplay-encoder by uncommenting the last line in the gameplay/CMakeLists.txt and running the CMake build via:
-
-```
-mkdir build
-cd build
-cmake ..
-make
- ```
+See [Building gameplay-encoder](https://github.com/blackberry/GamePlay/wiki/Building-gameplay-encoder) on the wiki.
 
 ## Bundle File Format
-The gameplay bundle file format is well defined in the gameplay-encoder/gameplay-bundle.txt file.
+The gameplay bundle file format is defined in the [tools/encoder/gameplay-bundle.txt](gameplay-bundle.txt) file.
 
 ## Bundle File Loading
-Bundle files can easily be loaded using the gameplay/Bundle.h which is part of the gameplay runtime framework.
+Bundle files can easily be loaded using the `gameplay/Bundle.h` which is part of the gameplay runtime framework.
 
 ## Disclaimer
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 

+ 48 - 43
tools/encoder/src/EncoderArguments.cpp

@@ -233,55 +233,60 @@ void splitString(const char* str, std::vector<std::string>* tokens)
 
 void EncoderArguments::printUsage() const
 {
-    LOG(1, "Usage: gameplay-encoder [options] <input filepath> <output filepath>\n\n");
-    LOG(1, "Supported file extensions:\n");
-    LOG(1, "  .fbx\t(FBX)\n");
-    LOG(1, "  .ttf\t(TrueType Font)\n");
-    LOG(1, "\n");
-    LOG(1, "General Options:\n");
-    LOG(1, "  -v <verbosity>\tVerbosity level (0-4).\n");
-    LOG(1, "\n");
-    LOG(1, "FBX file options:\n");
-    LOG(1, "  -i <id>\tFilter by node ID.\n");
-    LOG(1, "  -t\t\tWrite text/xml.\n");
-    LOG(1, "  -g:auto\tAutomatically group animation channels into a new animation.\n");
-    LOG(1, "  -g:none\tDo not prompt to group animations.\n");
-    LOG(1, "  -g <node id> <animation id>\n" \
-        "\t\tGroup all animation channels targeting the nodes into a new animation.\n");
-    LOG(1, "  -m\t\tOutput material file for scene.\n");
-    LOG(1, "  -tb <node id>\n" \
-        "\t\tGenerates tangents and binormals for the given node.\n");
-    LOG(1, "  -oa\n" \
+    LOG(1, "Usage: gameplay-encoder [options] <input filepath> <output filepath>\n\n" \
+    "Supported file extensions:\n" \
+    "  .fbx\t(FBX)\n" \
+    "  .ttf\t(TrueType Font)\n" \
+    "\n" \
+    "General Options:\n" \
+    "  -v <verbosity>\tVerbosity level (0-4).\n" \
+    "\n" \
+    "FBX file options:\n" \
+    "  -i <id>\tFilter by node ID.\n" \
+    "  -t\t\tWrite text/xml.\n" \
+    "  -g:auto\tAutomatically group animation channels into a new animation.\n" \
+    "  -g:none\tDo not prompt to group animations.\n" \
+    "  -g <node id> <animation id>\n" \
+        "\t\tGroup all animation channels targeting the nodes into a \n" \
+        "\t\tnew animation.\n" \
+    "  -m\t\tOutput material file for scene.\n" \
+    "  -tb <node id>\n" \
+        "\t\tGenerates tangents and binormals for the given node.\n" \
+    "  -oa\n" \
         "\t\tOptimizes animations by analyzing animation channel data and\n" \
         "\t\tremoving any channels that contain default/identity values\n" \
-        "\t\tand removing any duplicate contiguous keyframes, which are common\n" \
-        "\t\twhen exporting baked animation data.\n");
-    LOG(1, "  -h <size> \"<node ids>\" <filename>\n" \
-        "\t\tGenerates a single heightmap image using meshes from the specified\n" \
-        "\t\tnodes. <size> should be two comma-separated numbers in the format\n" \
-        "\t\t\"X,Y\", indicating the dimensions of the produced heightmap image.\n" \
+        "\t\tand removing any duplicate contiguous keyframes, which are \n" \
+        "\t\tcommon when exporting baked animation data.\n" \
+    "  -h <size> \"<node ids>\" <filename>\n" \
+        "\t\tGenerates a single heightmap image using meshes from the \n" \
+        "\t\tspecified nodes. \n" \
+        "\t\t<size> is two comma-separated numbers in the format \"X,Y\", \n" \
+        "\t\tindicating the dimensions of the produced heightmap image.\n" \
         "\t\t<node ids> should be in quotes with a space between each id.\n" \
         "\t\tFilename is the name of the image (PNG) to be saved.\n" \
-        "\t\tMultiple -h arguments can be supplied to generate more than one heightmap.\n" \
-        "\t\tFor 24-bit packed height data use -hp instead of -h.\n");
-    LOG(1, "\n");
-    LOG(1, "Normal map generation options:\n" \
+        "\t\tMultiple -h arguments can be supplied to generate more than one \n" \
+        "\t\theightmap. For 24-bit packed height data use -hp instead of -h.\n" \
+    "\n" \
+    "Normal map generation options:\n" \
         "  -n\t\tGenerate normal map (requires input file of type PNG or RAW)\n" \
-        "  -s\t\tSize/resolution of the input heightmap image (requried for RAW files)\n" \
-        "  -w <size>\tSpecifies the size of an input terran heightmap file in world\n" \
-        "\t\tunits, along the X, Y and Z axes. <size> should be three comma-separated\n" \
-        "\t\tnumbers in the format \"X,Y,Z\". The Y value represents the maximum\n" \
-        "\t\tpossible height value of a full intensity heightmap pixel.\n" \
+        "  -s\t\tSize/resolution of the input heightmap image \n" \
+        "    \t\t(required for RAW files)\n" \
+        "  -w <size>\tSpecifies the size of an input terrain heightmap file in world\n" \
+        "\t\tunits, along the X, Y and Z axes. <size> should be three \n" \
+        "\t\tcomma-separated numbers in the format \"X,Y,Z\". The Y value \n" \
+        "\t\trepresents the maximum possible height value of a full \n" \
+        "\t\tintensity heightmap pixel.\n" \
         "\n" \
-        "  Normal map generation can be used to create object-space normal maps from heightmap\n" \
-        "  images. Heightmaps must be in either PNG format (where the intensity of each pixel\n" \
-        "  represents a height value), or in RAW format (8 or 16-bit), which is a common\n" \
-        "  headerless format supported by most terran generation tools.\n");
-    LOG(1, "\n");
-    LOG(1, "TTF file options:\n");
-    LOG(1, "  -s <size>\tSize of the font.\n");
-    LOG(1, "  -p\t\tOutput font preview.\n");
-    LOG(1, "\n");
+        "  Normal map generation can be used to create object-space normal maps from \n" \
+        "  heightmap images. Heightmaps must be in either PNG format (where the \n" \
+        "  intensity of each pixel represents a height value), or in RAW format \n" \
+        "  (8 or 16-bit), which is a common headerless format supported by most \n" \
+        "  terrain generation tools.\n" \
+    "\n" \
+    "TTF file options:\n" \
+    "  -s <size>\tSize of the font.\n" \
+    "  -p\t\tOutput font preview.\n" \
+    "\n");
     exit(8);
 }
 

+ 1 - 1
tools/encoder/src/Material.cpp

@@ -16,7 +16,7 @@ Material::Material(const std::string& id) :
 
 Material::Material(const Material& c) :
     _parent(c._parent),
-    _id(c._id),
+    _id(c._id), _lit(false),
     _vertexShader(c._vertexShader),
     _fragmentShader(c._fragmentShader),
     _defines(c._defines),

+ 1 - 3
tools/encoder/src/MeshSkin.cpp

@@ -170,8 +170,6 @@ void MeshSkin::computeBounds()
 
     LOG(2, "Computing bounds for skin of mesh: %s\n", _mesh->getId().c_str());
 
-    Node* joint;
-
     // Get the root joint
     Node* rootJoint = _joints[0];
     Node* parent = rootJoint->getParent();
@@ -210,7 +208,7 @@ void MeshSkin::computeBounds()
     LOG(3, "  0%%\r");
     for (unsigned int i = 0; i < jointCount; ++i)
     {
-        joint = _joints[i];
+        Node* joint = _joints[i];
 
         // Find all animations that target this joint
         Animations* animations = GPBFile::getInstance()->getAnimations();

+ 10 - 10
tools/luagen/CMakeLists.txt

@@ -23,16 +23,16 @@ add_definitions(-lstdc++ -llua -ltinyxml2)
 set( APP_NAME gameplay-luagen )
 
 set(APP_SRC
-	src/Base.h
-	src/ClassBinding.cpp
-	src/ClassBinding.h
-	src/DebugNew.cpp
-	src/DebugNew.h
-	src/EnumBinding.h
-	src/FunctionBinding.cpp
-	src/FunctionBinding.h
-	src/Generator.cpp
-	src/Generator.h
+    src/Base.h
+    src/ClassBinding.cpp
+    src/ClassBinding.h
+    src/DebugNew.cpp
+    src/DebugNew.h
+    src/EnumBinding.h
+    src/FunctionBinding.cpp
+    src/FunctionBinding.h
+    src/Generator.cpp
+    src/Generator.h
     src/main.cpp
     src/TypedefBinding.h
 )