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

Changed Texture format enum values to closer match naming from GL ones and new Image format enum value names.
Added missing FrameBuffer, RenderTarget and DepthStencilTarget to VS project files.

Sean Paul Taylor 14 роки тому
батько
коміт
3773044426

+ 7 - 1
gameplay/gameplay.vcxproj

@@ -29,9 +29,11 @@
     <ClCompile Include="src\Camera.cpp" />
     <ClCompile Include="src\Curve.cpp" />
     <ClCompile Include="src\DebugNew.cpp" />
+    <ClCompile Include="src\DepthStencilTarget.cpp" />
     <ClCompile Include="src\Effect.cpp" />
     <ClCompile Include="src\FileSystem.cpp" />
     <ClCompile Include="src\Font.cpp" />
+    <ClCompile Include="src\FrameBuffer.cpp" />
     <ClCompile Include="src\Frustum.cpp" />
     <ClCompile Include="src\Game.cpp" />
     <ClCompile Include="src\gameplay-main-qnx.cpp" />
@@ -69,6 +71,7 @@
     <ClCompile Include="src\Rectangle.cpp" />
     <ClCompile Include="src\Ref.cpp" />
     <ClCompile Include="src\RenderState.cpp" />
+    <ClCompile Include="src\RenderTarget.cpp" />
     <ClCompile Include="src\Scene.cpp" />
     <ClCompile Include="src\SceneLoader.cpp" />
     <ClCompile Include="src\SpriteBatch.cpp" />
@@ -98,9 +101,11 @@
     <ClInclude Include="src\Camera.h" />
     <ClInclude Include="src\Curve.h" />
     <ClInclude Include="src\DebugNew.h" />
+    <ClInclude Include="src\DepthStencilTarget.h" />
     <ClInclude Include="src\Effect.h" />
     <ClInclude Include="src\FileSystem.h" />
     <ClInclude Include="src\Font.h" />
+    <ClInclude Include="src\FrameBuffer.h" />
     <ClInclude Include="src\Frustum.h" />
     <ClInclude Include="src\Game.h" />
     <ClInclude Include="src\gameplay.h" />
@@ -136,6 +141,7 @@
     <ClInclude Include="src\Rectangle.h" />
     <ClInclude Include="src\Ref.h" />
     <ClInclude Include="src\RenderState.h" />
+    <ClInclude Include="src\RenderTarget.h" />
     <ClInclude Include="src\Scene.h" />
     <ClInclude Include="src\SceneLoader.h" />
     <ClInclude Include="src\SpriteBatch.h" />
@@ -174,7 +180,7 @@
     <None Include="src\BoundingBox.inl" />
     <None Include="src\BoundingSphere.inl" />
     <None Include="src\Curve.inl" />
-    <None Include="src\Game.inl" />
+    <None Include="src\Game.inl" />
     <None Include="src\gameplay-main-macos.mm" />
     <None Include="src\Image.inl" />
     <None Include="src\Matrix.inl" />

+ 20 - 2
gameplay/gameplay.vcxproj.filters

@@ -213,6 +213,15 @@
     <ClCompile Include="src\Image.cpp">
       <Filter>src</Filter>
     </ClCompile>
+    <ClCompile Include="src\RenderTarget.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\FrameBuffer.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
+    <ClCompile Include="src\DepthStencilTarget.cpp">
+      <Filter>src</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\Animation.h">
@@ -410,6 +419,15 @@
     <ClInclude Include="src\Image.h">
       <Filter>src</Filter>
     </ClInclude>
+    <ClInclude Include="src\RenderTarget.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\FrameBuffer.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="src\DepthStencilTarget.h">
+      <Filter>src</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="res\shaders\bumped-specular.vsh">
@@ -482,8 +500,8 @@
       <Filter>res\textures</Filter>
     </None>
     <None Include="src\Curve.inl">
-        <Filter>src</Filter>
-    </None>
+      <Filter>src</Filter>
+    </None>
     <None Include="src\Game.inl">
       <Filter>src</Filter>
     </None>

+ 2 - 2
gameplay/src/Image.cpp

@@ -65,11 +65,11 @@ Image* Image::create(const char* path)
     switch (colorType)
     {
     case PNG_COLOR_TYPE_RGBA:
-        image->_format = RGBA;
+        image->_format = Image::RGBA;
         break;
 
     case PNG_COLOR_TYPE_RGB:
-        image->_format = RGB;
+        image->_format = Image::RGB;
         break;
 
     default:

+ 1 - 1
gameplay/src/RenderTarget.cpp

@@ -26,7 +26,7 @@ RenderTarget::~RenderTarget()
 RenderTarget* RenderTarget::create(const char* id, unsigned int width, unsigned int height)
 {
     // Create a new texture with the given width
-    Texture* texture = Texture::create(Texture::RGBA8888, width, height, NULL, false);
+    Texture* texture = Texture::create(Texture::RGBA, width, height, NULL, false);
     if (texture == NULL)
     {
         return NULL;

+ 2 - 2
gameplay/src/Texture.cpp

@@ -95,9 +95,9 @@ Texture* Texture::create(Image* image, bool generateMipmaps)
     switch (image->getFormat())
     {
     case Image::RGB:
-        return create(RGB888, image->getWidth(), image->getHeight(), image->getData(), generateMipmaps);
+        return create(Texture::RGB, image->getWidth(), image->getHeight(), image->getData(), generateMipmaps);
     case Image::RGBA:
-        return create(RGBA8888, image->getWidth(), image->getHeight(), image->getData(), generateMipmaps);
+        return create(Texture::RGBA, image->getWidth(), image->getHeight(), image->getData(), generateMipmaps);
     }
     
     return NULL;

+ 4 - 4
gameplay/src/Texture.h

@@ -22,10 +22,10 @@ public:
      */
     enum Format
     {
-        ALPHA = GL_ALPHA,
-        RGB888 = GL_RGB,
-        RGBA8888 = GL_RGBA,
-        DEPTH = GL_DEPTH_COMPONENT
+        RGB     = GL_RGB,
+        RGBA    = GL_RGBA,
+        ALPHA   = GL_ALPHA,
+        DEPTH   = GL_DEPTH_COMPONENT
     };
 
     /**