Ver código fonte

Changes gameplay::Package to gameplay::Bundle.

setaylor 13 anos atrás
pai
commit
30e23f15b2

+ 6 - 7
gameplay-encoder/README.md

@@ -1,6 +1,6 @@
 ## gameplay-encoder
 ## gameplay-encoder
 Command-line tool for encoding games assets like true-type fonts and 3D scene files
 Command-line tool for encoding games assets like true-type fonts and 3D scene files
-into a binary package file format for the gameplay 3D game framework runtime. 
+into a simple binary-based bundle file format for the gameplay 3D game framework runtime. 
 
 
 ## TrueType Font Support
 ## TrueType Font Support
 TrueType Fonts conversion is enabled/built-in by default into gameplay-encoder via freetype 2 library.
 TrueType Fonts conversion is enabled/built-in by default into gameplay-encoder via freetype 2 library.
@@ -30,7 +30,7 @@ You must then rebuild gameplay-encoder with the follow platform/tooling instruct
   * Example: copy /Y "C:\Program Files\Autodesk\FBX\FbxSdk\2012.2\lib\vs2010\x86\fbxsdk-2012.2d.dll" "$(TargetDir)"
   * Example: copy /Y "C:\Program Files\Autodesk\FBX\FbxSdk\2012.2\lib\vs2010\x86\fbxsdk-2012.2d.dll" "$(TargetDir)"
 - Build gameplay-encoder
 - Build gameplay-encoder
 
 
-### Building FBX Support on Mac OS X using XCode 4
+### Building FBX Support on Mac OS X using XCode 4.3.2+
 - Download and install the FBX SDK for Mac OS X (http://www.autodesk.com/fbx)
 - Download and install the FBX SDK for Mac OS X (http://www.autodesk.com/fbx)
 - Edit the project properties of target "gameplay-encoder".
 - Edit the project properties of target "gameplay-encoder".
 - Add Preprocessor Macro "USE_FBX" to both Debug/Release sections. (Build Settings)
 - Add Preprocessor Macro "USE_FBX" to both Debug/Release sections. (Build Settings)
@@ -41,12 +41,11 @@ You must then rebuild gameplay-encoder with the follow platform/tooling instruct
   * Example: libiconv.dylib, Cocoa.framework, SystemConfiguration.framework
   * Example: libiconv.dylib, Cocoa.framework, SystemConfiguration.framework
 - Build gameplay-encoder
 - Build gameplay-encoder
 
 
-## Binary Format
-The gameplay binary package format is well defined in the gameplay-encoder/gameplay-binary.txt file.
+## Bundle File Format
+The gameplay bundle file format is well defined in the gameplay-encoder/gameplay-bundle.txt file.
 
 
-## Binary Loading
-Binary package files can easily be loaded using the gameplay/Package.h which is part
-of the GamePlay runtime framework.
+## Bundle File Loading
+Bundle files can easily be loaded using the gameplay/Bundle.h which is part of the gameplay runtime framework.
 
 
 ## Disclaimer
 ## Disclaimer
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 

+ 10 - 10
gameplay-encoder/gameplay-binary.txt → gameplay-encoder/gameplay-bundle.txt

@@ -1,16 +1,16 @@
-gameplay Binary file format
+gameplay Bundle File Format (.gpb)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
 File Description
 File Description
 ================
 ================
-A sample binary file format supporting definition of primitve and builtin objects.
+A simple binary bundle file format supporting definition of primitve and builtin objects.
 
 
 File Extension and Mime Type
 File Extension and Mime Type
 ============================
 ============================
-File extension is '.bbb' and the mime type is 'application/bbb'
+File extension is '.gpb' and the mime type is 'application/gpb'
 
 
 File Structure
 File Structure
-===============
+==============
 
 
 Section      Name            Type
 Section      Name            Type
 ------------------------------------------------------------------------------------------------------
 ------------------------------------------------------------------------------------------------------
@@ -22,31 +22,31 @@ Data
              Objects         Object[]
              Objects         Object[]
 
 
 Objects
 Objects
-===========
+=======
 Supported object types are defined in the table below. Object with unique ids are included
 Supported object types are defined in the table below. Object with unique ids are included
 in the Reference table (see below).
 in the Reference table (see below).
 
 
 References
 References
-===========
+==========
 A Reference is an Object that has a unique id. The Reference contains the unique id of the
 A Reference is an Object that has a unique id. The Reference contains the unique id of the
 object, a uint for the TypeID a uint for the offset into the package for the object definition.
 object, a uint for the TypeID a uint for the offset into the package for the object definition.
 
 
 ID's
 ID's
-===========
+====
 Object ID's are represented as a string which is guaranteed to be unique per file.
 Object ID's are represented as a string which is guaranteed to be unique per file.
 Any object which host an object id should be added to the header Reference table so that it can
 Any object which host an object id should be added to the header Reference table so that it can
 be consumed by reference internally and externally.
 be consumed by reference internally and externally.
 
 
 Xrefs
 Xrefs
-===========
+=====
 Xrefs are string with a specific format used for referencing objects internal and external to
 Xrefs are string with a specific format used for referencing objects internal and external to
 a package. An xref with the format "#id" references an object within the current package with
 a package. An xref with the format "#id" references an object within the current package with
 the given ID. Xrefs can also have the format "file#id", where "file" is the name of package file
 the given ID. Xrefs can also have the format "file#id", where "file" is the name of package file
 (relative to the locaiton of the current package) and "id" is the unique identifier of an object
 (relative to the locaiton of the current package) and "id" is the unique identifier of an object
-in that package.
+in that bundle.
 
 
 Primitives
 Primitives
-===========
+==========
 
 
 Name            Description
 Name            Description
 ------------------------------------------------------------------------------------------------------
 ------------------------------------------------------------------------------------------------------

+ 7 - 7
gameplay.sln

@@ -20,7 +20,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample03-character", "gamep
 EndProject
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-encoder", "gameplay-encoder\gameplay-encoder.vcxproj", "{9D69B743-4872-4DD1-8E30-0087C64298D7}"
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-encoder", "gameplay-encoder\gameplay-encoder.vcxproj", "{9D69B743-4872-4DD1-8E30-0087C64298D7}"
 EndProject
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample04-particles", "gameplay-samples\sample04-particles\sample04-particles.vcxproj", "{BB38678F-2614-C502-956C-0FFD84566556}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample04-particles", "gameplay-samples\sample04-particles\sample04-particles.vcxproj", "{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}"
 	ProjectSection(ProjectDependencies) = postProject
 	ProjectSection(ProjectDependencies) = postProject
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 	EndProjectSection
 	EndProjectSection
@@ -67,12 +67,12 @@ Global
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.DebugMem|Win32.Build.0 = Debug|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.DebugMem|Win32.Build.0 = Debug|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.ActiveCfg = Release|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.ActiveCfg = Release|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.Build.0 = Release|Win32
 		{9D69B743-4872-4DD1-8E30-0087C64298D7}.Release|Win32.Build.0 = Release|Win32
-		{BB38678F-2614-C502-956C-0FFD84566556}.Debug|Win32.ActiveCfg = Debug|Win32
-		{BB38678F-2614-C502-956C-0FFD84566556}.Debug|Win32.Build.0 = Debug|Win32
-		{BB38678F-2614-C502-956C-0FFD84566556}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
-		{BB38678F-2614-C502-956C-0FFD84566556}.DebugMem|Win32.Build.0 = DebugMem|Win32
-		{BB38678F-2614-C502-956C-0FFD84566556}.Release|Win32.ActiveCfg = Release|Win32
-		{BB38678F-2614-C502-956C-0FFD84566556}.Release|Win32.Build.0 = Release|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.ActiveCfg = Debug|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.Build.0 = Debug|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.ActiveCfg = Release|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.Build.0 = Release|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.Build.0 = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.Build.0 = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32

+ 2 - 3
gameplay/gameplay.vcxproj

@@ -60,7 +60,7 @@
     <ClCompile Include="src\MeshSkin.cpp" />
     <ClCompile Include="src\MeshSkin.cpp" />
     <ClCompile Include="src\Model.cpp" />
     <ClCompile Include="src\Model.cpp" />
     <ClCompile Include="src\Node.cpp" />
     <ClCompile Include="src\Node.cpp" />
-    <ClCompile Include="src\Package.cpp" />
+    <ClCompile Include="src\Bundle.cpp" />
     <ClCompile Include="src\ParticleEmitter.cpp" />
     <ClCompile Include="src\ParticleEmitter.cpp" />
     <ClCompile Include="src\PhysicsCharacter.cpp" />
     <ClCompile Include="src\PhysicsCharacter.cpp" />
     <ClCompile Include="src\PhysicsCollisionObject.cpp" />
     <ClCompile Include="src\PhysicsCollisionObject.cpp" />
@@ -151,7 +151,7 @@
     <ClInclude Include="src\MeshSkin.h" />
     <ClInclude Include="src\MeshSkin.h" />
     <ClInclude Include="src\Model.h" />
     <ClInclude Include="src\Model.h" />
     <ClInclude Include="src\Node.h" />
     <ClInclude Include="src\Node.h" />
-    <ClInclude Include="src\Package.h" />
+    <ClInclude Include="src\Bundle.h" />
     <ClInclude Include="src\ParticleEmitter.h" />
     <ClInclude Include="src\ParticleEmitter.h" />
     <ClInclude Include="src\PhysicsCharacter.h" />
     <ClInclude Include="src\PhysicsCharacter.h" />
     <ClInclude Include="src\PhysicsCollisionObject.h" />
     <ClInclude Include="src\PhysicsCollisionObject.h" />
@@ -221,7 +221,6 @@
     <None Include="res\shaders\solid.vsh" />
     <None Include="res\shaders\solid.vsh" />
     <None Include="res\shaders\textured.fsh" />
     <None Include="res\shaders\textured.fsh" />
     <None Include="res\shaders\textured.vsh" />
     <None Include="res\shaders\textured.vsh" />
-    <None Include="res\textures\particle-default.png" />
     <None Include="src\BoundingBox.inl" />
     <None Include="src\BoundingBox.inl" />
     <None Include="src\BoundingSphere.inl" />
     <None Include="src\BoundingSphere.inl" />
     <None Include="src\Curve.inl" />
     <None Include="src\Curve.inl" />

+ 6 - 12
gameplay/gameplay.vcxproj.filters

@@ -10,9 +10,6 @@
     <Filter Include="res\shaders">
     <Filter Include="res\shaders">
       <UniqueIdentifier>{be0b36f1-49ed-4a06-9f1f-57c654a554fe}</UniqueIdentifier>
       <UniqueIdentifier>{be0b36f1-49ed-4a06-9f1f-57c654a554fe}</UniqueIdentifier>
     </Filter>
     </Filter>
-    <Filter Include="res\textures">
-      <UniqueIdentifier>{7c4ef2fb-63f2-4d5a-b31e-0dc78329abfd}</UniqueIdentifier>
-    </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="src\Animation.cpp">
     <ClCompile Include="src\Animation.cpp">
@@ -75,9 +72,6 @@
     <ClCompile Include="src\Node.cpp">
     <ClCompile Include="src\Node.cpp">
       <Filter>src</Filter>
       <Filter>src</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="src\Package.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="src\Plane.cpp">
     <ClCompile Include="src\Plane.cpp">
       <Filter>src</Filter>
       <Filter>src</Filter>
     </ClCompile>
     </ClCompile>
@@ -279,6 +273,9 @@
     <ClCompile Include="src\Layout.cpp">
     <ClCompile Include="src\Layout.cpp">
       <Filter>src</Filter>
       <Filter>src</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="src\Bundle.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\Animation.h">
     <ClInclude Include="src\Animation.h">
@@ -350,9 +347,6 @@
     <ClInclude Include="src\Node.h">
     <ClInclude Include="src\Node.h">
       <Filter>src</Filter>
       <Filter>src</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="src\Package.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="src\Plane.h">
     <ClInclude Include="src\Plane.h">
       <Filter>src</Filter>
       <Filter>src</Filter>
     </ClInclude>
     </ClInclude>
@@ -551,6 +545,9 @@
     <ClInclude Include="src\ThemeStyle.h">
     <ClInclude Include="src\ThemeStyle.h">
       <Filter>src</Filter>
       <Filter>src</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="src\Bundle.h">
+      <Filter>src</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <None Include="res\shaders\bumped-specular.vsh">
     <None Include="res\shaders\bumped-specular.vsh">
@@ -619,9 +616,6 @@
     <None Include="src\PlatformMacOSX.mm">
     <None Include="src\PlatformMacOSX.mm">
       <Filter>src</Filter>
       <Filter>src</Filter>
     </None>
     </None>
-    <None Include="res\textures\particle-default.png">
-      <Filter>res\textures</Filter>
-    </None>
     <None Include="src\Curve.inl">
     <None Include="src\Curve.inl">
       <Filter>src</Filter>
       <Filter>src</Filter>
     </None>
     </None>

+ 1 - 1
gameplay/src/Animation.h

@@ -24,7 +24,7 @@ class Animation : public Ref
 {
 {
     friend class AnimationClip;
     friend class AnimationClip;
     friend class AnimationTarget;
     friend class AnimationTarget;
-    friend class Package;
+    friend class Bundle;
 
 
 public:
 public:
     
     

+ 84 - 84
gameplay/src/Package.cpp → gameplay/src/Bundle.cpp

@@ -1,5 +1,5 @@
 #include "Base.h"
 #include "Base.h"
-#include "Package.h"
+#include "Bundle.h"
 #include "FileSystem.h"
 #include "FileSystem.h"
 #include "MeshPart.h"
 #include "MeshPart.h"
 #include "Scene.h"
 #include "Scene.h"
@@ -29,22 +29,22 @@
 namespace gameplay
 namespace gameplay
 {
 {
 
 
-static std::vector<Package*> __packageCache;
+static std::vector<Bundle*> __bundleCache;
 
 
-Package::Package(const char* path) :
+Bundle::Bundle(const char* path) :
     _path(path), _referenceCount(0), _references(NULL), _file(NULL)
     _path(path), _referenceCount(0), _references(NULL), _file(NULL)
 {
 {
 }
 }
 
 
-Package::~Package()
+Bundle::~Bundle()
 {
 {
     clearLoadSession();
     clearLoadSession();
 
 
-    // Remove this Package from the cache
-    std::vector<Package*>::iterator itr = std::find(__packageCache.begin(), __packageCache.end(), this);
-    if (itr != __packageCache.end())
+    // Remove this Bundle from the cache
+    std::vector<Bundle*>::iterator itr = std::find(__bundleCache.begin(), __bundleCache.end(), this);
+    if (itr != __bundleCache.end())
     {
     {
-        __packageCache.erase(itr);
+        __bundleCache.erase(itr);
     }
     }
 
 
     SAFE_DELETE_ARRAY(_references);
     SAFE_DELETE_ARRAY(_references);
@@ -57,7 +57,7 @@ Package::~Package()
 }
 }
 
 
 template <class T>
 template <class T>
-bool Package::readArray(unsigned int* length, T** ptr)
+bool Bundle::readArray(unsigned int* length, T** ptr)
 {
 {
     if (!read(length))
     if (!read(length))
     {
     {
@@ -76,7 +76,7 @@ bool Package::readArray(unsigned int* length, T** ptr)
 }
 }
 
 
 template <class T>
 template <class T>
-bool Package::readArray(unsigned int* length, std::vector<T>* values)
+bool Bundle::readArray(unsigned int* length, std::vector<T>* values)
 {
 {
     if (!read(length))
     if (!read(length))
     {
     {
@@ -94,7 +94,7 @@ bool Package::readArray(unsigned int* length, std::vector<T>* values)
 }
 }
 
 
 template <class T>
 template <class T>
-bool Package::readArray(unsigned int* length, std::vector<T>* values, unsigned int readSize)
+bool Bundle::readArray(unsigned int* length, std::vector<T>* values, unsigned int readSize)
 {
 {
     assert(sizeof(T) >= readSize);
     assert(sizeof(T) >= readSize);
 
 
@@ -136,12 +136,12 @@ std::string readString(FILE* fp)
     return str;
     return str;
 }
 }
 
 
-Package* Package::create(const char* path)
+Bundle* Bundle::create(const char* path)
 {
 {
-    // Search the cache for this package
-    for (unsigned int i = 0, count = __packageCache.size(); i < count; ++i)
+    // Search the cache for this bundle
+    for (unsigned int i = 0, count = __bundleCache.size(); i < count; ++i)
     {
     {
-        Package* p = __packageCache[i];
+        Bundle* p = __bundleCache[i];
         if (p->_path == path)
         if (p->_path == path)
         {
         {
             // Found a match
             // Found a match
@@ -150,7 +150,7 @@ Package* Package::create(const char* path)
         }
         }
     }
     }
 
 
-    // Open the package
+    // Open the bundle
     FILE* fp = FileSystem::openFile(path, "rb");
     FILE* fp = FileSystem::openFile(path, "rb");
     if (!fp)
     if (!fp)
     {
     {
@@ -162,7 +162,7 @@ Package* Package::create(const char* path)
     char sig[9];
     char sig[9];
     if (fread(sig, 1, 9, fp) != 9 || memcmp(sig, "«GPB»\r\n\x1A\n", 9) != 0)
     if (fread(sig, 1, 9, fp) != 9 || memcmp(sig, "«GPB»\r\n\x1A\n", 9) != 0)
     {
     {
-        LOG_ERROR_VARG("Invalid package header: %s", path);
+        LOG_ERROR_VARG("Invalid bundle header: %s", path);
         fclose(fp);
         fclose(fp);
         return NULL;
         return NULL;
     }
     }
@@ -171,7 +171,7 @@ Package* Package::create(const char* path)
     unsigned char ver[2];
     unsigned char ver[2];
     if (fread(ver, 1, 2, fp) != 2 || ver[0] != GPB_PACKAGE_VERSION_MAJOR || ver[1] != GPB_PACKAGE_VERSION_MINOR)
     if (fread(ver, 1, 2, fp) != 2 || ver[0] != GPB_PACKAGE_VERSION_MAJOR || ver[1] != GPB_PACKAGE_VERSION_MINOR)
     {
     {
-        LOG_ERROR_VARG("Unsupported version (%d.%d) for package: %s (expected %d.%d)", (int)ver[0], (int)ver[1], path, GPB_PACKAGE_VERSION_MAJOR, GPB_PACKAGE_VERSION_MINOR);
+        LOG_ERROR_VARG("Unsupported version (%d.%d) for bundle: %s (expected %d.%d)", (int)ver[0], (int)ver[1], path, GPB_PACKAGE_VERSION_MAJOR, GPB_PACKAGE_VERSION_MINOR);
         fclose(fp);
         fclose(fp);
         return NULL;
         return NULL;
     }
     }
@@ -199,7 +199,7 @@ Package* Package::create(const char* path)
     }
     }
 
 
     // Keep file open for faster reading later
     // Keep file open for faster reading later
-    Package* pkg = new Package(path);
+    Bundle* pkg = new Bundle(path);
     pkg->_referenceCount = refCount;
     pkg->_referenceCount = refCount;
     pkg->_references = refs;
     pkg->_references = refs;
     pkg->_file = fp;
     pkg->_file = fp;
@@ -207,7 +207,7 @@ Package* Package::create(const char* path)
     return pkg;
     return pkg;
 }
 }
 
 
-Package::Reference* Package::find(const char* id) const
+Bundle::Reference* Bundle::find(const char* id) const
 {
 {
     // Search the ref table for the given id (case-sensitive)
     // Search the ref table for the given id (case-sensitive)
     for (unsigned int i = 0; i < _referenceCount; ++i)
     for (unsigned int i = 0; i < _referenceCount; ++i)
@@ -222,7 +222,7 @@ Package::Reference* Package::find(const char* id) const
     return NULL;
     return NULL;
 }
 }
 
 
-void Package::clearLoadSession()
+void Bundle::clearLoadSession()
 {
 {
     for (unsigned int i = 0, count = _meshSkins.size(); i < count; ++i)
     for (unsigned int i = 0, count = _meshSkins.size(); i < count; ++i)
     {
     {
@@ -231,12 +231,12 @@ void Package::clearLoadSession()
     _meshSkins.clear();
     _meshSkins.clear();
 }
 }
 
 
-const char* Package::getIdFromOffset() const
+const char* Bundle::getIdFromOffset() const
 {
 {
     return getIdFromOffset((unsigned int) ftell(_file));
     return getIdFromOffset((unsigned int) ftell(_file));
 }
 }
 
 
-const char* Package::getIdFromOffset(unsigned int offset) const
+const char* Bundle::getIdFromOffset(unsigned int offset) const
 {
 {
     // Search the ref table for the given offset
     // Search the ref table for the given offset
     if (offset > 0)
     if (offset > 0)
@@ -252,32 +252,32 @@ const char* Package::getIdFromOffset(unsigned int offset) const
     return NULL;
     return NULL;
 }
 }
 
 
-Package::Reference* Package::seekTo(const char* id, unsigned int type)
+Bundle::Reference* Bundle::seekTo(const char* id, unsigned int type)
 {
 {
     Reference* ref = find(id);
     Reference* ref = find(id);
     if (ref == NULL)
     if (ref == NULL)
     {
     {
-        LOG_ERROR_VARG("No object with name '%s' in package '%s'.", id, _path.c_str());
+        LOG_ERROR_VARG("No object with name '%s' in bundle '%s'.", id, _path.c_str());
         return NULL;
         return NULL;
     }
     }
 
 
     if (ref->type != type)
     if (ref->type != type)
     {
     {
-        LOG_ERROR_VARG("Object '%s' in package '%s' has type %d (expected type %d).", id, _path.c_str(), (int)ref->type, (int)type);
+        LOG_ERROR_VARG("Object '%s' in bundle '%s' has type %d (expected type %d).", id, _path.c_str(), (int)ref->type, (int)type);
         return NULL;
         return NULL;
     }
     }
 
 
     // Seek to the offset of this object
     // Seek to the offset of this object
     if (fseek(_file, ref->offset, SEEK_SET) != 0)
     if (fseek(_file, ref->offset, SEEK_SET) != 0)
     {
     {
-        LOG_ERROR_VARG("Failed to seek to object '%s' in package '%s'.", id, _path.c_str());
+        LOG_ERROR_VARG("Failed to seek to object '%s' in bundle '%s'.", id, _path.c_str());
         return NULL;
         return NULL;
     }
     }
 
 
     return ref;
     return ref;
 }
 }
 
 
-Package::Reference* Package::seekToFirstType(unsigned int type)
+Bundle::Reference* Bundle::seekToFirstType(unsigned int type)
 {
 {
     // for each Reference
     // for each Reference
     for (unsigned int i = 0; i < _referenceCount; ++i)
     for (unsigned int i = 0; i < _referenceCount; ++i)
@@ -288,7 +288,7 @@ Package::Reference* Package::seekToFirstType(unsigned int type)
             // Found a match
             // Found a match
             if (fseek(_file, ref->offset, SEEK_SET) != 0)
             if (fseek(_file, ref->offset, SEEK_SET) != 0)
             {
             {
-                LOG_ERROR_VARG("Failed to seek to object '%s' in package '%s'.", ref->id.c_str(), _path.c_str());
+                LOG_ERROR_VARG("Failed to seek to object '%s' in bundle '%s'.", ref->id.c_str(), _path.c_str());
                 return NULL;
                 return NULL;
             }
             }
             return ref;
             return ref;
@@ -297,27 +297,27 @@ Package::Reference* Package::seekToFirstType(unsigned int type)
     return NULL;
     return NULL;
 }
 }
 
 
-bool Package::read(unsigned int* ptr)
+bool Bundle::read(unsigned int* ptr)
 {
 {
     return fread(ptr, sizeof(unsigned int), 1, _file) == 1;
     return fread(ptr, sizeof(unsigned int), 1, _file) == 1;
 }
 }
 
 
-bool Package::read(unsigned char* ptr)
+bool Bundle::read(unsigned char* ptr)
 {
 {
     return fread(ptr, sizeof(unsigned char), 1, _file) == 1;
     return fread(ptr, sizeof(unsigned char), 1, _file) == 1;
 }
 }
 
 
-bool Package::read(float* ptr)
+bool Bundle::read(float* ptr)
 {
 {
     return fread(ptr, sizeof(float), 1, _file) == 1;
     return fread(ptr, sizeof(float), 1, _file) == 1;
 }
 }
 
 
-bool Package::readMatrix(float* m)
+bool Bundle::readMatrix(float* m)
 {
 {
     return (fread(m, sizeof(float), 16, _file) == 16);
     return (fread(m, sizeof(float), 16, _file) == 16);
 }
 }
 
 
-Scene* Package::loadScene(const char* id)
+Scene* Bundle::loadScene(const char* id)
 {
 {
     clearLoadSession();
     clearLoadSession();
 
 
@@ -398,7 +398,7 @@ Scene* Package::loadScene(const char* id)
             // Found a match
             // Found a match
             if (fseek(_file, ref->offset, SEEK_SET) != 0)
             if (fseek(_file, ref->offset, SEEK_SET) != 0)
             {
             {
-                LOG_ERROR_VARG("Failed to seek to object '%s' in package '%s'.", ref->id.c_str(), _path.c_str());
+                LOG_ERROR_VARG("Failed to seek to object '%s' in bundle '%s'.", ref->id.c_str(), _path.c_str());
                 return NULL;
                 return NULL;
             }
             }
             readAnimations(scene);
             readAnimations(scene);
@@ -410,7 +410,7 @@ Scene* Package::loadScene(const char* id)
     return scene;
     return scene;
 }
 }
 
 
-Node* Package::loadNode(const char* id)
+Node* Bundle::loadNode(const char* id)
 {
 {
     assert(id);
     assert(id);
 
 
@@ -426,7 +426,7 @@ Node* Package::loadNode(const char* id)
     return node;
     return node;
 }
 }
 
 
-Node* Package::loadNode(const char* id, Scene* sceneContext, Node* nodeContext)
+Node* Bundle::loadNode(const char* id, Scene* sceneContext, Node* nodeContext)
 {
 {
     assert(id);
     assert(id);
 
 
@@ -458,7 +458,7 @@ Node* Package::loadNode(const char* id, Scene* sceneContext, Node* nodeContext)
     return node;
     return node;
 }
 }
 
 
-Node* Package::readNode(Scene* sceneContext, Node* nodeContext)
+Node* Bundle::readNode(Scene* sceneContext, Node* nodeContext)
 {
 {
     const char* id = getIdFromOffset();
     const char* id = getIdFromOffset();
 
 
@@ -545,12 +545,12 @@ Node* Package::readNode(Scene* sceneContext, Node* nodeContext)
     return node;
     return node;
 }
 }
 
 
-Camera* Package::readCamera()
+Camera* Bundle::readCamera()
 {
 {
     unsigned char cameraType;
     unsigned char cameraType;
     if (!read(&cameraType))
     if (!read(&cameraType))
     {
     {
-        LOG_ERROR_VARG("Failed to load camera type in package '%s'.", _path.c_str());
+        LOG_ERROR_VARG("Failed to load camera type in bundle '%s'.", _path.c_str());
     }
     }
 
 
     if (cameraType == 0)
     if (cameraType == 0)
@@ -562,21 +562,21 @@ Camera* Package::readCamera()
     float aspectRatio;
     float aspectRatio;
     if (!read(&aspectRatio))
     if (!read(&aspectRatio))
     {
     {
-        LOG_ERROR_VARG("Failed to load camera aspectRatio in package '%s'.", _path.c_str());
+        LOG_ERROR_VARG("Failed to load camera aspectRatio in bundle '%s'.", _path.c_str());
     }
     }
 
 
     // near plane
     // near plane
     float nearPlane;
     float nearPlane;
     if (!read(&nearPlane))
     if (!read(&nearPlane))
     {
     {
-        LOG_ERROR_VARG("Failed to load camera near plane in package '%s'.", _path.c_str());
+        LOG_ERROR_VARG("Failed to load camera near plane in bundle '%s'.", _path.c_str());
     }
     }
 
 
     // far plane
     // far plane
     float farPlane;
     float farPlane;
     if (!read(&farPlane))
     if (!read(&farPlane))
     {
     {
-        LOG_ERROR_VARG("Failed to load camera far plane in package '%s'.", _path.c_str());
+        LOG_ERROR_VARG("Failed to load camera far plane in bundle '%s'.", _path.c_str());
     }
     }
 
 
     Camera* camera = NULL;
     Camera* camera = NULL;
@@ -586,7 +586,7 @@ Camera* Package::readCamera()
         float fieldOfView;
         float fieldOfView;
         if (!read(&fieldOfView))
         if (!read(&fieldOfView))
         {
         {
-            LOG_ERROR_VARG("Failed to load camera field of view in package '%s'.", _path.c_str());
+            LOG_ERROR_VARG("Failed to load camera field of view in bundle '%s'.", _path.c_str());
         }
         }
 
 
         camera = Camera::createPerspective(fieldOfView, aspectRatio, nearPlane, farPlane);
         camera = Camera::createPerspective(fieldOfView, aspectRatio, nearPlane, farPlane);
@@ -597,30 +597,30 @@ Camera* Package::readCamera()
         float zoomX;
         float zoomX;
         if (!read(&zoomX))
         if (!read(&zoomX))
         {
         {
-            LOG_ERROR_VARG("Failed to load camera zoomX in package '%s'.", _path.c_str());
+            LOG_ERROR_VARG("Failed to load camera zoomX in bundle '%s'.", _path.c_str());
         }
         }
 
 
         float zoomY;
         float zoomY;
         if (!read(&zoomY))
         if (!read(&zoomY))
         {
         {
-            LOG_ERROR_VARG("Failed to load camera zoomY in package '%s'.", _path.c_str());
+            LOG_ERROR_VARG("Failed to load camera zoomY in bundle '%s'.", _path.c_str());
         }
         }
 
 
         camera = Camera::createOrthographic(zoomX, zoomY, aspectRatio, nearPlane, farPlane);
         camera = Camera::createOrthographic(zoomX, zoomY, aspectRatio, nearPlane, farPlane);
     }
     }
     else
     else
     {
     {
-        LOG_ERROR_VARG("Failed to load camera type in package '%s'. Invalid camera type.", _path.c_str());
+        LOG_ERROR_VARG("Failed to load camera type in bundle '%s'. Invalid camera type.", _path.c_str());
     }
     }
     return camera;
     return camera;
 }
 }
 
 
-Light* Package::readLight()
+Light* Bundle::readLight()
 {
 {
     unsigned char type;
     unsigned char type;
     if (!read(&type))
     if (!read(&type))
     {
     {
-        LOG_ERROR_VARG("Failed to load light %s in package '%s'.", "type", _path.c_str());
+        LOG_ERROR_VARG("Failed to load light %s in bundle '%s'.", "type", _path.c_str());
     }
     }
 
 
     if (type == 0)
     if (type == 0)
@@ -632,7 +632,7 @@ Light* Package::readLight()
     float red, blue, green;
     float red, blue, green;
     if (!read(&red) || !read(&blue) || !read(&green))
     if (!read(&red) || !read(&blue) || !read(&green))
     {
     {
-        LOG_ERROR_VARG("Failed to load light %s in package '%s'.", "color", _path.c_str());
+        LOG_ERROR_VARG("Failed to load light %s in bundle '%s'.", "color", _path.c_str());
     }
     }
     Vector3 color(red, blue, green);
     Vector3 color(red, blue, green);
 
 
@@ -646,7 +646,7 @@ Light* Package::readLight()
         float range;
         float range;
         if (!read(&range))
         if (!read(&range))
         {
         {
-            LOG_ERROR_VARG("Failed to load point light %s in package '%s'.", "point", _path.c_str());
+            LOG_ERROR_VARG("Failed to load point light %s in bundle '%s'.", "point", _path.c_str());
         }
         }
         light = Light::createPoint(color, range);
         light = Light::createPoint(color, range);
     }
     }
@@ -655,18 +655,18 @@ Light* Package::readLight()
         float range, innerAngle, outerAngle;
         float range, innerAngle, outerAngle;
         if (!read(&range) || !read(&innerAngle) || !read(&outerAngle))
         if (!read(&range) || !read(&innerAngle) || !read(&outerAngle))
         {
         {
-            LOG_ERROR_VARG("Failed to load spot light %s in package '%s'.", "spot", _path.c_str());
+            LOG_ERROR_VARG("Failed to load spot light %s in bundle '%s'.", "spot", _path.c_str());
         }
         }
         light = Light::createSpot(color, range, innerAngle, outerAngle);
         light = Light::createSpot(color, range, innerAngle, outerAngle);
     }
     }
     else
     else
     {
     {
-        LOG_ERROR_VARG("Failed to load light %s in package '%s'.", "type", _path.c_str());
+        LOG_ERROR_VARG("Failed to load light %s in bundle '%s'.", "type", _path.c_str());
     }
     }
     return light;
     return light;
 }
 }
 
 
-Model* Package::readModel(Scene* sceneContext, Node* nodeContext, const char* nodeId)
+Model* Bundle::readModel(Scene* sceneContext, Node* nodeContext, const char* nodeId)
 {
 {
     // Read mesh
     // Read mesh
     Mesh* mesh = NULL;
     Mesh* mesh = NULL;
@@ -683,7 +683,7 @@ Model* Package::readModel(Scene* sceneContext, Node* nodeContext, const char* no
             unsigned char hasSkin;
             unsigned char hasSkin;
             if (!read(&hasSkin))
             if (!read(&hasSkin))
             {
             {
-                LOG_ERROR_VARG("Failed to load hasSkin in package '%s'.", _path.c_str());
+                LOG_ERROR_VARG("Failed to load hasSkin in bundle '%s'.", _path.c_str());
                 return NULL;
                 return NULL;
             }
             }
             if (hasSkin)
             if (hasSkin)
@@ -698,7 +698,7 @@ Model* Package::readModel(Scene* sceneContext, Node* nodeContext, const char* no
             unsigned int materialCount;
             unsigned int materialCount;
             if (!read(&materialCount))
             if (!read(&materialCount))
             {
             {
-                LOG_ERROR_VARG("Failed to load materialCount in package '%s'.", _path.c_str());
+                LOG_ERROR_VARG("Failed to load materialCount in bundle '%s'.", _path.c_str());
                 return NULL;
                 return NULL;
             }
             }
             if (materialCount > 0)
             if (materialCount > 0)
@@ -712,7 +712,7 @@ Model* Package::readModel(Scene* sceneContext, Node* nodeContext, const char* no
     return NULL;
     return NULL;
 }
 }
 
 
-MeshSkin* Package::readMeshSkin(Scene* sceneContext, Node* nodeContext)
+MeshSkin* Bundle::readMeshSkin(Scene* sceneContext, Node* nodeContext)
 {
 {
     MeshSkin* meshSkin = new MeshSkin();
     MeshSkin* meshSkin = new MeshSkin();
 
 
@@ -720,7 +720,7 @@ MeshSkin* Package::readMeshSkin(Scene* sceneContext, Node* nodeContext)
     float bindShape[16];
     float bindShape[16];
     if (!readMatrix(bindShape))
     if (!readMatrix(bindShape))
     {
     {
-        LOG_ERROR_VARG("Failed to load MeshSkin in package '%s'.", _path.c_str());
+        LOG_ERROR_VARG("Failed to load MeshSkin in bundle '%s'.", _path.c_str());
         SAFE_DELETE(meshSkin);
         SAFE_DELETE(meshSkin);
         return NULL;
         return NULL;
     }
     }
@@ -733,7 +733,7 @@ MeshSkin* Package::readMeshSkin(Scene* sceneContext, Node* nodeContext)
     unsigned int jointCount;
     unsigned int jointCount;
     if (!read(&jointCount))
     if (!read(&jointCount))
     {
     {
-        LOG_ERROR_VARG("Failed to load MeshSkin in package '%s'.", _path.c_str());
+        LOG_ERROR_VARG("Failed to load MeshSkin in bundle '%s'.", _path.c_str());
         SAFE_DELETE(meshSkin);
         SAFE_DELETE(meshSkin);
         SAFE_DELETE(skinData);
         SAFE_DELETE(skinData);
         return NULL;
         return NULL;
@@ -756,7 +756,7 @@ MeshSkin* Package::readMeshSkin(Scene* sceneContext, Node* nodeContext)
     unsigned int jointsBindPosesCount;
     unsigned int jointsBindPosesCount;
     if (!read(&jointsBindPosesCount))
     if (!read(&jointsBindPosesCount))
     {
     {
-        LOG_ERROR_VARG("Failed to load MeshSkin in package '%s'.", _path.c_str());
+        LOG_ERROR_VARG("Failed to load MeshSkin in bundle '%s'.", _path.c_str());
         SAFE_DELETE(meshSkin);
         SAFE_DELETE(meshSkin);
         SAFE_DELETE(skinData);
         SAFE_DELETE(skinData);
         return NULL;
         return NULL;
@@ -769,7 +769,7 @@ MeshSkin* Package::readMeshSkin(Scene* sceneContext, Node* nodeContext)
         {
         {
             if (!readMatrix(m))
             if (!readMatrix(m))
             {
             {
-                LOG_ERROR_VARG("Failed to load MeshSkin in package '%s'.", _path.c_str());
+                LOG_ERROR_VARG("Failed to load MeshSkin in bundle '%s'.", _path.c_str());
                 SAFE_DELETE(meshSkin);
                 SAFE_DELETE(meshSkin);
                 SAFE_DELETE(skinData);
                 SAFE_DELETE(skinData);
                 return NULL;
                 return NULL;
@@ -784,7 +784,7 @@ MeshSkin* Package::readMeshSkin(Scene* sceneContext, Node* nodeContext)
     return meshSkin;
     return meshSkin;
 }
 }
 
 
-void Package::resolveJointReferences(Scene* sceneContext, Node* nodeContext)
+void Bundle::resolveJointReferences(Scene* sceneContext, Node* nodeContext)
 {
 {
     const unsigned int skinCount = _meshSkins.size();
     const unsigned int skinCount = _meshSkins.size();
     for (unsigned int i = 0; i < skinCount; ++i)
     for (unsigned int i = 0; i < skinCount; ++i)
@@ -834,7 +834,7 @@ void Package::resolveJointReferences(Scene* sceneContext, Node* nodeContext)
     _meshSkins.clear();
     _meshSkins.clear();
 }
 }
 
 
-void Package::readAnimation(Scene* scene)
+void Bundle::readAnimation(Scene* scene)
 {
 {
     const std::string animationId = readString(_file);
     const std::string animationId = readString(_file);
 
 
@@ -854,7 +854,7 @@ void Package::readAnimation(Scene* scene)
     }
     }
 }
 }
 
 
-void Package::readAnimations(Scene* scene)
+void Bundle::readAnimations(Scene* scene)
 {
 {
     // read the number of animations in this object
     // read the number of animations in this object
     unsigned int animationCount;
     unsigned int animationCount;
@@ -870,7 +870,7 @@ void Package::readAnimations(Scene* scene)
     }
     }
 }
 }
 
 
-Animation* Package::readAnimationChannel(Scene* scene, Animation* animation, const char* animationId)
+Animation* Bundle::readAnimationChannel(Scene* scene, Animation* animation, const char* animationId)
 {
 {
     const char* id = animationId;
     const char* id = animationId;
 
 
@@ -975,12 +975,12 @@ Animation* Package::readAnimationChannel(Scene* scene, Animation* animation, con
     return animation;
     return animation;
 }
 }
 
 
-Mesh* Package::loadMesh(const char* id)
+Mesh* Bundle::loadMesh(const char* id)
 {
 {
     return loadMesh(id, false);
     return loadMesh(id, false);
 }
 }
 
 
-Mesh* Package::loadMesh(const char* id, const char* nodeId)
+Mesh* Bundle::loadMesh(const char* id, const char* nodeId)
 {
 {
     // Save the file position
     // Save the file position
     long position = ftell(_file);
     long position = ftell(_file);
@@ -1040,7 +1040,7 @@ Mesh* Package::loadMesh(const char* id, const char* nodeId)
     return mesh;
     return mesh;
 }
 }
 
 
-Package::MeshData* Package::readMeshData()
+Bundle::MeshData* Bundle::readMeshData()
 {
 {
     // Read vertex format/elements
     // Read vertex format/elements
     unsigned int vertexElementCount;
     unsigned int vertexElementCount;
@@ -1145,7 +1145,7 @@ Package::MeshData* Package::readMeshData()
     return meshData;
     return meshData;
 }
 }
 
 
-Package::MeshData* Package::readMeshData(const char* url)
+Bundle::MeshData* Bundle::readMeshData(const char* url)
 {
 {
     assert(url);
     assert(url);
 
 
@@ -1153,7 +1153,7 @@ Package::MeshData* Package::readMeshData(const char* url)
     if (len == 0)
     if (len == 0)
         return NULL;
         return NULL;
 
 
-    // Parse URL (formatted as 'package#id')
+    // Parse URL (formatted as 'bundle#id')
     std::string urlstring(url);
     std::string urlstring(url);
     unsigned int pos = urlstring.find('#');
     unsigned int pos = urlstring.find('#');
     if (pos == std::string::npos)
     if (pos == std::string::npos)
@@ -1162,12 +1162,12 @@ Package::MeshData* Package::readMeshData(const char* url)
     std::string file = urlstring.substr(0, pos);
     std::string file = urlstring.substr(0, pos);
     std::string id = urlstring.substr(pos + 1);
     std::string id = urlstring.substr(pos + 1);
 
 
-    // Load package
-    Package* pkg = Package::create(file.c_str());
+    // Load bundle
+    Bundle* pkg = Bundle::create(file.c_str());
     if (pkg == NULL)
     if (pkg == NULL)
         return NULL;
         return NULL;
 
 
-    // Seek to mesh with specified ID in package
+    // Seek to mesh with specified ID in bundle
     Reference* ref = pkg->seekTo(id.c_str(), PACKAGE_TYPE_MESH);
     Reference* ref = pkg->seekTo(id.c_str(), PACKAGE_TYPE_MESH);
     if (ref == NULL)
     if (ref == NULL)
         return NULL;
         return NULL;
@@ -1180,7 +1180,7 @@ Package::MeshData* Package::readMeshData(const char* url)
     return meshData;
     return meshData;
 }
 }
 
 
-Font* Package::loadFont(const char* id)
+Font* Bundle::loadFont(const char* id)
 {
 {
     // Seek to the specified Font
     // Seek to the specified Font
     Reference* ref = seekTo(id, PACKAGE_TYPE_FONT);
     Reference* ref = seekTo(id, PACKAGE_TYPE_FONT);
@@ -1280,7 +1280,7 @@ Font* Package::loadFont(const char* id)
     return font;
     return font;
 }
 }
 
 
-void Package::setTransform(const float* values, Transform* transform)
+void Bundle::setTransform(const float* values, Transform* transform)
 {
 {
     // Load array into transform
     // Load array into transform
     Matrix matrix(values);
     Matrix matrix(values);
@@ -1292,46 +1292,46 @@ void Package::setTransform(const float* values, Transform* transform)
     transform->setRotation(rotation);
     transform->setRotation(rotation);
 }
 }
 
 
-bool Package::contains(const char* id) const
+bool Bundle::contains(const char* id) const
 {
 {
     return (find(id) != NULL);
     return (find(id) != NULL);
 }
 }
 
 
-unsigned int Package::getObjectCount() const
+unsigned int Bundle::getObjectCount() const
 {
 {
     return _referenceCount;
     return _referenceCount;
 }
 }
 
 
-const char* Package::getObjectID(unsigned int index) const
+const char* Bundle::getObjectID(unsigned int index) const
 {
 {
     return (index >= _referenceCount ? NULL : _references[index].id.c_str());
     return (index >= _referenceCount ? NULL : _references[index].id.c_str());
 }
 }
 
 
-Package::Reference::Reference()
+Bundle::Reference::Reference()
     : type(0), offset(0)
     : type(0), offset(0)
 {
 {
 }
 }
 
 
-Package::Reference::~Reference()
+Bundle::Reference::~Reference()
 {
 {
 }
 }
 
 
-Package::MeshPartData::MeshPartData() :
+Bundle::MeshPartData::MeshPartData() :
     indexCount(0), indexData(NULL)
     indexCount(0), indexData(NULL)
 {
 {
 }
 }
 
 
-Package::MeshPartData::~MeshPartData()
+Bundle::MeshPartData::~MeshPartData()
 {
 {
     SAFE_DELETE_ARRAY(indexData);
     SAFE_DELETE_ARRAY(indexData);
 }
 }
 
 
-Package::MeshData::MeshData(const VertexFormat& vertexFormat)
+Bundle::MeshData::MeshData(const VertexFormat& vertexFormat)
     : vertexFormat(vertexFormat), vertexCount(0), vertexData(NULL)
     : vertexFormat(vertexFormat), vertexCount(0), vertexData(NULL)
 {
 {
 }
 }
 
 
-Package::MeshData::~MeshData()
+Bundle::MeshData::~MeshData()
 {
 {
     SAFE_DELETE_ARRAY(vertexData);
     SAFE_DELETE_ARRAY(vertexData);
 
 

+ 23 - 23
gameplay/src/Package.h → gameplay/src/Bundle.h

@@ -1,5 +1,5 @@
-#ifndef PACKAGE_H_
-#define PACKAGE_H_
+#ifndef BUNDLE_H_
+#define BUNDLE_H_
 
 
 #include "Mesh.h"
 #include "Mesh.h"
 #include "Font.h"
 #include "Font.h"
@@ -10,29 +10,29 @@ namespace gameplay
 {
 {
 
 
 /**
 /**
- * Represents a gameplay binary package file (.gpb) that contains a
+ * Represents a gameplay bundle file (.gpb) that contains a
  * collection of game resources that can be loaded.
  * collection of game resources that can be loaded.
  */
  */
-class Package : public Ref
+class Bundle : public Ref
 {
 {
     friend class PhysicsController;
     friend class PhysicsController;
 
 
 public:
 public:
 
 
     /**
     /**
-     * Returns a Package for the given resource path.
+     * Returns a Bundle for the given resource path.
      *
      *
-     * The specified path must reference a valid gameplay binary file.
-     * If the package is already loaded, the existing package is returned
+     * The specified path must reference a valid gameplay bundle file.
+     * If the bundle is already loaded, the existing bundle is returned
      * with its reference count incremented. When no longer needed, the
      * with its reference count incremented. When no longer needed, the
      * release() method must be called. Note that calling release() does
      * release() method must be called. Note that calling release() does
-     * NOT free any actual game objects created/returned from the Package
+     * NOT free any actual game objects created/returned from the Bundle
      * instance and those objects must be released separately.
      * instance and those objects must be released separately.
      */
      */
-    static Package* create(const char* path);
+    static Bundle* create(const char* path);
 
 
     /**
     /**
-     * Loads the scene with the specified ID from the package.
+     * Loads the scene with the specified ID from the bundle.
      * If id is NULL then the first scene found is loaded.
      * If id is NULL then the first scene found is loaded.
      * 
      * 
      * @param id The ID of the scene to load (NULL to load the first scene).
      * @param id The ID of the scene to load (NULL to load the first scene).
@@ -42,16 +42,16 @@ public:
     Scene* loadScene(const char* id = NULL);
     Scene* loadScene(const char* id = NULL);
 
 
     /**
     /**
-     * Loads a node with the specified ID from the package.
+     * Loads a node with the specified ID from the bundle.
      *
      *
-     * @param id The ID of the node to load in the package.
+     * @param id The ID of the node to load in the bundle.
      * 
      * 
      * @return The loaded node, or NULL if the node could not be loaded.
      * @return The loaded node, or NULL if the node could not be loaded.
      */
      */
     Node* loadNode(const char* id);
     Node* loadNode(const char* id);
 
 
     /**
     /**
-     * Loads a mesh with the specified ID from the package.
+     * Loads a mesh with the specified ID from the bundle.
      *
      *
      * @param id The ID of the mesh to load.
      * @param id The ID of the mesh to load.
      * 
      * 
@@ -60,7 +60,7 @@ public:
     Mesh* loadMesh(const char* id);
     Mesh* loadMesh(const char* id);
 
 
     /**
     /**
-     * Loads a font with the specified ID from the package.
+     * Loads a font with the specified ID from the bundle.
      *
      *
      * @param id The ID of the font to load.
      * @param id The ID of the font to load.
      * 
      * 
@@ -69,7 +69,7 @@ public:
     Font* loadFont(const char* id);
     Font* loadFont(const char* id);
 
 
     /**
     /**
-     * Determines if this package contains a top-level object with the given ID.
+     * Determines if this bundle contains a top-level object with the given ID.
      *
      *
      * This method performs a case-sensitive comparison.
      * This method performs a case-sensitive comparison.
      *
      *
@@ -78,12 +78,12 @@ public:
     bool contains(const char* id) const;
     bool contains(const char* id) const;
 
 
     /**
     /**
-     * Returns the number of top-level objects in this package.
+     * Returns the number of top-level objects in this bundle.
      */
      */
     unsigned int getObjectCount() const;
     unsigned int getObjectCount() const;
 
 
     /**
     /**
-     * Returns the unique identifier of the top-level object at the specified index in this package.
+     * Returns the unique identifier of the top-level object at the specified index in this bundle.
      *
      *
      * @param index The index of the object.
      * @param index The index of the object.
      * 
      * 
@@ -143,12 +143,12 @@ private:
         std::vector<MeshPartData*> parts;
         std::vector<MeshPartData*> parts;
     };
     };
 
 
-    Package(const char* path);
+    Bundle(const char* path);
 
 
     /**
     /**
      * Destructor.
      * Destructor.
      */
      */
-    ~Package();
+    ~Bundle();
 
 
     /**
     /**
      * Finds a reference by ID.
      * Finds a reference by ID.
@@ -156,7 +156,7 @@ private:
     Reference* find(const char* id) const;
     Reference* find(const char* id) const;
 
 
     /**
     /**
-     * Resets any load session specific state for the package.
+     * Resets any load session specific state for the bundle.
      */
      */
     void clearLoadSession();
     void clearLoadSession();
 
 
@@ -206,7 +206,7 @@ private:
     Node* loadNode(const char* id, Scene* sceneContext, Node* nodeContext);
     Node* loadNode(const char* id, Scene* sceneContext, Node* nodeContext);
 
 
     /**
     /**
-     * Loads a mesh with the specified ID from the package.
+     * Loads a mesh with the specified ID from the bundle.
      *
      *
      * @param id The ID of the mesh to load.
      * @param id The ID of the mesh to load.
      * @param nodeId The id of the mesh's model's parent node.
      * @param nodeId The id of the mesh's model's parent node.
@@ -331,8 +331,8 @@ private:
     /**
     /**
      * Reads mesh data for the specified URL.
      * Reads mesh data for the specified URL.
      *
      *
-     * The specified URL should be formatted as 'package#id', where
-     * 'package' is the package file containing the mesh and 'id' is the ID
+     * The specified URL should be formatted as 'bundle#id', where
+     * 'bundle' is the bundle file containing the mesh and 'id' is the ID
      * of the mesh to read data for.
      * of the mesh to read data for.
      *
      *
      * @param url The URL to read mesh data from.
      * @param url The URL to read mesh data from.

+ 5 - 5
gameplay/src/Font.cpp

@@ -2,7 +2,7 @@
 #include "Font.h"
 #include "Font.h"
 #include "Game.h"
 #include "Game.h"
 #include "FileSystem.h"
 #include "FileSystem.h"
-#include "Package.h"
+#include "Bundle.h"
 
 
 // Default font vertex shader
 // Default font vertex shader
 #define FONT_VSH \
 #define FONT_VSH \
@@ -78,8 +78,8 @@ Font* Font::create(const char* path, const char* id)
         }
         }
     }
     }
 
 
-    // Load the package.
-    Package* pkg = Package::create(path);
+    // Load the bundle.
+    Bundle* pkg = Bundle::create(path);
     if (pkg == NULL)
     if (pkg == NULL)
     {
     {
         return NULL;
         return NULL;
@@ -89,14 +89,14 @@ Font* Font::create(const char* path, const char* id)
 
 
     if (id == NULL)
     if (id == NULL)
     {
     {
-        // Get the ID of the first/only object in the package (assume it's a Font).
+        // Get the ID of the first/only object in the bundle (assume it's a Font).
         const char* id;
         const char* id;
         if (pkg->getObjectCount() != 1 || (id = pkg->getObjectID(0)) == NULL)
         if (pkg->getObjectCount() != 1 || (id = pkg->getObjectID(0)) == NULL)
         {
         {
             return NULL;
             return NULL;
         }
         }
 
 
-        // Load the font using the ID of the first object in the package.
+        // Load the font using the ID of the first object in the bundle.
         font = pkg->loadFont(pkg->getObjectID(0));
         font = pkg->loadFont(pkg->getObjectID(0));
     }
     }
     else
     else

+ 6 - 6
gameplay/src/Font.h

@@ -11,7 +11,7 @@ namespace gameplay
  */
  */
 class Font : public Ref
 class Font : public Ref
 {
 {
-    friend class Package;
+    friend class Bundle;
     friend class TextBox;
     friend class TextBox;
 
 
 public:
 public:
@@ -77,17 +77,17 @@ public:
     };
     };
 
 
     /**
     /**
-     * Creates a font from the given package.
+     * Creates a font from the given bundle.
      *
      *
-     * If the 'id' parameter is NULL, it is assumed that the Package at 'path'
-     * contains exactly one Font resource. If the Package does not meet this criteria,
+     * If the 'id' parameter is NULL, it is assumed that the Bundle at 'path'
+     * contains exactly one Font resource. If the Bundle does not meet this criteria,
      * NULL is returned.
      * NULL is returned.
      *
      *
      * If a font for the given path has already been loaded, the existing font will be
      * If a font for the given path has already been loaded, the existing font will be
      * returned with its reference count increased.
      * returned with its reference count increased.
      *
      *
-     * @param path The path to a package file containing a font resource.
-     * @param id An optional ID of the font resource within the package (NULL for the first/only resource).
+     * @param path The path to a bundle file containing a font resource.
+     * @param id An optional ID of the font resource within the bundle (NULL for the first/only resource).
      * 
      * 
      * @return The specified font.
      * @return The specified font.
      */
      */

+ 2 - 2
gameplay/src/Joint.h

@@ -7,7 +7,7 @@ namespace gameplay
 {
 {
 
 
 class MeshSkin;
 class MeshSkin;
-class Package;
+class Bundle;
 
 
 /**
 /**
  * Defines a basic hierachial structure of transformation spaces.
  * Defines a basic hierachial structure of transformation spaces.
@@ -16,7 +16,7 @@ class Joint : public Node
 {
 {
     friend class Node;
     friend class Node;
     friend class MeshSkin;
     friend class MeshSkin;
-    friend class Package;
+    friend class Bundle;
 
 
 public:
 public:
 
 

+ 5 - 5
gameplay/src/Mesh.h

@@ -21,7 +21,7 @@ class Model;
 class Mesh : public Ref
 class Mesh : public Ref
 {
 {
     friend class Model;
     friend class Model;
-    friend class Package;
+    friend class Bundle;
 
 
 public:
 public:
 
 
@@ -126,8 +126,8 @@ public:
     /**
     /**
      * Returns a URL from which the mesh was loaded from.
      * Returns a URL from which the mesh was loaded from.
      *
      *
-     * For meshes loaded from a Package, this URL will point
-     * to the file and ID of the mesh within the package. For
+     * For meshes loaded from a Bundle, this URL will point
+     * to the file and ID of the mesh within the bundle. For
      * all other meshes, an empty string will be returned.
      * all other meshes, an empty string will be returned.
      */
      */
     const char* getUrl() const;
     const char* getUrl() const;
@@ -230,7 +230,7 @@ public:
     /**
     /**
      * Returns the bounding box for the points in this mesh.
      * Returns the bounding box for the points in this mesh.
      * 
      * 
-     * Only meshes loaded from package files are imported with valid
+     * Only meshes loaded from bundle files are imported with valid
      * bounding volumes. Programmatically created meshes will contain
      * bounding volumes. Programmatically created meshes will contain
      * empty bounding volumes until the setBoundingBox and/or
      * empty bounding volumes until the setBoundingBox and/or
      * setBoundingSphere methods are called to specify the mesh's
      * setBoundingSphere methods are called to specify the mesh's
@@ -259,7 +259,7 @@ public:
     /**
     /**
      * Returns the bounding sphere for the points in the mesh.
      * Returns the bounding sphere for the points in the mesh.
      *
      *
-     * Only meshes loaded from package files are imported with valid
+     * Only meshes loaded from bundle files are imported with valid
      * bounding volumes. Programmatically created meshes will contain
      * bounding volumes. Programmatically created meshes will contain
      * empty bounding volumes until the setBoundingBox and/or
      * empty bounding volumes until the setBoundingBox and/or
      * setBoundingSphere methods are called to specify the mesh's
      * setBoundingSphere methods are called to specify the mesh's

+ 2 - 2
gameplay/src/MeshSkin.h

@@ -7,7 +7,7 @@
 namespace gameplay
 namespace gameplay
 {
 {
 
 
-class Package;
+class Bundle;
 class Model;
 class Model;
 class Joint;
 class Joint;
 class Node;
 class Node;
@@ -17,7 +17,7 @@ class Node;
  */
  */
 class MeshSkin : public Transform::Listener
 class MeshSkin : public Transform::Listener
 {
 {
-    friend class Package;
+    friend class Bundle;
     friend class Model;
     friend class Model;
     friend class Joint;
     friend class Joint;
 
 

+ 2 - 2
gameplay/src/Model.h

@@ -8,7 +8,7 @@
 namespace gameplay
 namespace gameplay
 {
 {
 
 
-class Package;
+class Bundle;
 class MeshSkin;
 class MeshSkin;
 class Node;
 class Node;
 class NodeCloneContext;
 class NodeCloneContext;
@@ -21,7 +21,7 @@ class Model : public Ref
 {
 {
     friend class Node;
     friend class Node;
     friend class Mesh;
     friend class Mesh;
-    friend class Package;
+    friend class Bundle;
 
 
 public:
 public:
 
 

+ 2 - 2
gameplay/src/Node.h

@@ -16,7 +16,7 @@
 namespace gameplay
 namespace gameplay
 {
 {
 
 
-class Package;
+class Bundle;
 class Scene;
 class Scene;
 class Form;
 class Form;
 
 
@@ -26,7 +26,7 @@ class Form;
 class Node : public Transform, public Ref
 class Node : public Transform, public Ref
 {
 {
     friend class Scene;
     friend class Scene;
-    friend class Package;
+    friend class Bundle;
     friend class MeshSkin;
     friend class MeshSkin;
 
 
 public:
 public:

+ 4 - 4
gameplay/src/PhysicsController.cpp

@@ -5,7 +5,7 @@
 #include "PhysicsMotionState.h"
 #include "PhysicsMotionState.h"
 #include "Game.h"
 #include "Game.h"
 #include "MeshPart.h"
 #include "MeshPart.h"
-#include "Package.h"
+#include "Bundle.h"
 
 
 #include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
 #include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
 
 
@@ -927,7 +927,7 @@ PhysicsCollisionShape* PhysicsController::createMesh(Mesh* mesh, const Vector3&
         return NULL;
         return NULL;
     }
     }
 
 
-    // The mesh must have a valid URL (i.e. it must have been loaded from a Package)
+    // The mesh must have a valid URL (i.e. it must have been loaded from a Bundle)
     // in order to fetch mesh data for computing mesh rigid body.
     // in order to fetch mesh data for computing mesh rigid body.
     if (strlen(mesh->getUrl()) == 0)
     if (strlen(mesh->getUrl()) == 0)
     {
     {
@@ -935,7 +935,7 @@ PhysicsCollisionShape* PhysicsController::createMesh(Mesh* mesh, const Vector3&
         return NULL;
         return NULL;
     }
     }
 
 
-    Package::MeshData* data = Package::readMeshData(mesh->getUrl());
+    Bundle::MeshData* data = Bundle::readMeshData(mesh->getUrl());
     if (data == NULL)
     if (data == NULL)
     {
     {
         return NULL;
         return NULL;
@@ -968,7 +968,7 @@ PhysicsCollisionShape* PhysicsController::createMesh(Mesh* mesh, const Vector3&
     {
     {
         PHY_ScalarType indexType = PHY_UCHAR;
         PHY_ScalarType indexType = PHY_UCHAR;
         int indexStride = 0;
         int indexStride = 0;
-        Package::MeshPartData* meshPart = NULL;
+        Bundle::MeshPartData* meshPart = NULL;
         for (unsigned int i = 0; i < partCount; i++)
         for (unsigned int i = 0; i < partCount; i++)
         {
         {
             meshPart = data->parts[i];
             meshPart = data->parts[i];

+ 1 - 1
gameplay/src/Quaternion.h

@@ -16,7 +16,7 @@ class Matrix;
  * Quaternions are typically used as a replacement for euler angles and rotation matrices as a way to achieve smooth interpolation and avoid gimbal lock.
  * Quaternions are typically used as a replacement for euler angles and rotation matrices as a way to achieve smooth interpolation and avoid gimbal lock.
  *
  *
  * Note that this quaternion class does not automatically keep the quaternion normalized. Therefore, care must be taken to normalize the quaternion when neccessary, by calling the normalize method.
  * Note that this quaternion class does not automatically keep the quaternion normalized. Therefore, care must be taken to normalize the quaternion when neccessary, by calling the normalize method.
- * The package provides three methods for doing quaternion interpolation: lerp, slerp, and squad.
+ * This class provides three methods for doing quaternion interpolation: lerp, slerp, and squad.
  *
  *
  * lerp (linear interpolation): the interpolation curve gives a straight line in quaternion space. It is simple and fast to compute. The only problem is that it does not provide constant angular velocity. Note that a constant velocity is not necessarily a requirement for a curve;
  * lerp (linear interpolation): the interpolation curve gives a straight line in quaternion space. It is simple and fast to compute. The only problem is that it does not provide constant angular velocity. Note that a constant velocity is not necessarily a requirement for a curve;
  * slerp (spherical linear interpolation): the interpolation curve forms a great arc on the quaternion unit sphere. Slerp provides constant angular velocity;
  * slerp (spherical linear interpolation): the interpolation curve forms a great arc on the quaternion unit sphere. Slerp provides constant angular velocity;

+ 9 - 9
gameplay/src/SceneLoader.cpp

@@ -1,6 +1,6 @@
 #include "Base.h"
 #include "Base.h"
 #include "Game.h"
 #include "Game.h"
-#include "Package.h"
+#include "Bundle.h"
 #include "SceneLoader.h"
 #include "SceneLoader.h"
 
 
 namespace gameplay
 namespace gameplay
@@ -438,10 +438,10 @@ void SceneLoader::applyNodeUrls(Scene* scene)
             {
             {
                 // An external file was referenced, so load the node from file and then insert it into the scene with the new ID.
                 // An external file was referenced, so load the node from file and then insert it into the scene with the new ID.
 
 
-                // TODO: Revisit this to determine if we should cache Package objects for the duration of the scene
+                // TODO: Revisit this to determine if we should cache Bundle objects for the duration of the scene
                 // load to prevent constantly creating/destroying the same externally referenced packages each time
                 // load to prevent constantly creating/destroying the same externally referenced packages each time
                 // a url with a file is encountered.
                 // a url with a file is encountered.
-                Package* tmpPackage = Package::create(snp._file.c_str());
+                Bundle* tmpPackage = Bundle::create(snp._file.c_str());
                 if (tmpPackage)
                 if (tmpPackage)
                 {
                 {
                     if (sceneNode._exactMatch)
                     if (sceneNode._exactMatch)
@@ -460,7 +460,7 @@ void SceneLoader::applyNodeUrls(Scene* scene)
                     }
                     }
                     else
                     else
                     {
                     {
-                        // Search for nodes in the package using a partial match
+                        // Search for nodes in the bundle using a partial match
                         std::string partialMatch = snp._id;
                         std::string partialMatch = snp._id;
                         unsigned int objectCount = tmpPackage->getObjectCount();
                         unsigned int objectCount = tmpPackage->getObjectCount();
                         unsigned int matchCount = 0;
                         unsigned int matchCount = 0;
@@ -755,19 +755,19 @@ PhysicsConstraint* SceneLoader::loadHingeConstraint(const Properties* constraint
 Scene* SceneLoader::loadMainSceneData(const Properties* sceneProperties)
 Scene* SceneLoader::loadMainSceneData(const Properties* sceneProperties)
 {
 {
     // Load the main scene from the specified path.
     // Load the main scene from the specified path.
-    Package* package = Package::create(_path.c_str());
-    if (!package)
+    Bundle* bundle = Bundle::create(_path.c_str());
+    if (!bundle)
     {
     {
         WARN_VARG("Failed to load scene GPB file '%s'.", _path.c_str());
         WARN_VARG("Failed to load scene GPB file '%s'.", _path.c_str());
         return NULL;
         return NULL;
     }
     }
 
 
     const char* sceneID = strlen(sceneProperties->getId()) == 0 ? NULL : sceneProperties->getId();
     const char* sceneID = strlen(sceneProperties->getId()) == 0 ? NULL : sceneProperties->getId();
-    Scene* scene = package->loadScene(sceneID);
+    Scene* scene = bundle->loadScene(sceneID);
     if (!scene)
     if (!scene)
     {
     {
         WARN_VARG("Failed to load scene from '%s'.", _path.c_str());
         WARN_VARG("Failed to load scene from '%s'.", _path.c_str());
-        SAFE_RELEASE(package);
+        SAFE_RELEASE(bundle);
         return NULL;
         return NULL;
     }
     }
 
 
@@ -780,7 +780,7 @@ Scene* SceneLoader::loadMainSceneData(const Properties* sceneProperties)
             scene->setActiveCamera(camera->getCamera());
             scene->setActiveCamera(camera->getCamera());
     }
     }
 
 
-    SAFE_RELEASE(package);
+    SAFE_RELEASE(bundle);
     return scene;
     return scene;
 }
 }
 
 

+ 1 - 1
gameplay/src/SpriteBatch.h

@@ -24,7 +24,7 @@ namespace gameplay
  */
  */
 class SpriteBatch
 class SpriteBatch
 {
 {
-    friend class Package;
+    friend class Bundle;
 
 
 public:
 public:
 
 

+ 1 - 1
gameplay/src/gameplay.h

@@ -6,7 +6,7 @@
 #include "Touch.h"
 #include "Touch.h"
 #include "Mouse.h"
 #include "Mouse.h"
 #include "FileSystem.h"
 #include "FileSystem.h"
-#include "Package.h"
+#include "Bundle.h"
 
 
 // Math
 // Math
 #include "Rectangle.h"
 #include "Rectangle.h"