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

Fixed GCC 64-bit compiler warning.

Wei Tjong Yao 12 лет назад
Родитель
Сommit
5f834fe1b1
2 измененных файлов с 13 добавлено и 13 удалено
  1. 3 3
      Engine/Graphics/Batch.cpp
  2. 10 10
      Engine/Graphics/OpenGL/OGLGraphics.cpp

+ 3 - 3
Engine/Graphics/Batch.cpp

@@ -212,7 +212,7 @@ void Batch::Prepare(View* view, bool setModelTransform) const
     
     // Set camera shader parameters
     unsigned cameraHash = overrideView_ ? (unsigned)(size_t)camera_ + 4 : (unsigned)(size_t)camera_;
-    if (graphics->NeedParameterUpdate(SP_CAMERA, (void*)cameraHash))
+    if (graphics->NeedParameterUpdate(SP_CAMERA, reinterpret_cast<void*>(cameraHash)))
     {
         // Calculate camera rotation just once
         Matrix3 cameraWorldRotation = cameraNode->GetWorldRotation().RotationMatrix();
@@ -267,7 +267,7 @@ void Batch::Prepare(View* view, bool setModelTransform) const
     IntRect viewport = graphics->GetViewport();
     unsigned viewportHash = (viewport.left_) | (viewport.top_ << 8) | (viewport.right_ << 16) | (viewport.bottom_ << 24);
     
-    if (graphics->NeedParameterUpdate(SP_VIEWPORT, (void*)viewportHash))
+    if (graphics->NeedParameterUpdate(SP_VIEWPORT, reinterpret_cast<void*>(viewportHash)))
     {
         float rtWidth = (float)rtSize.x_;
         float rtHeight = (float)rtSize.y_;
@@ -300,7 +300,7 @@ void Batch::Prepare(View* view, bool setModelTransform) const
     BlendMode blend = graphics->GetBlendMode();
     Zone* fogColorZone = (blend == BLEND_ADD || blend == BLEND_ADDALPHA) ? renderer->GetDefaultZone() : zone_;
     unsigned zoneHash = (unsigned)(size_t)zone_ + (unsigned)(size_t)fogColorZone;
-    if (zone_ && graphics->NeedParameterUpdate(SP_ZONE, (void*)zoneHash))
+    if (zone_ && graphics->NeedParameterUpdate(SP_ZONE, reinterpret_cast<void*>(zoneHash)))
     {
         graphics->SetShaderParameter(VSP_AMBIENTSTARTCOLOR, zone_->GetAmbientStartColor());
         graphics->SetShaderParameter(VSP_AMBIENTENDCOLOR, zone_->GetAmbientEndColor().ToVector4() - zone_->GetAmbientStartColor().ToVector4());

+ 10 - 10
Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -668,17 +668,17 @@ void Graphics::Draw(PrimitiveType type, unsigned indexStart, unsigned indexCount
     case TRIANGLE_LIST:
         primitiveCount = indexCount / 3;
         if (indexSize == sizeof(unsigned short))
-            glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_SHORT, (const GLvoid*)(indexStart * indexSize));
+            glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_SHORT, reinterpret_cast<const GLvoid*>(indexStart * indexSize));
         else
-            glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, (const GLvoid*)(indexStart * indexSize));
+            glDrawElements(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, reinterpret_cast<const GLvoid*>(indexStart * indexSize));
         break;
         
     case LINE_LIST:
         primitiveCount = indexCount / 2;
         if (indexSize == sizeof(unsigned short))
-            glDrawElements(GL_LINES, indexCount, GL_UNSIGNED_SHORT, (const GLvoid*)(indexStart * indexSize));
+            glDrawElements(GL_LINES, indexCount, GL_UNSIGNED_SHORT, reinterpret_cast<const GLvoid*>(indexStart * indexSize));
         else
-            glDrawElements(GL_LINES, indexCount, GL_UNSIGNED_INT, (const GLvoid*)(indexStart * indexSize));
+            glDrawElements(GL_LINES, indexCount, GL_UNSIGNED_INT, reinterpret_cast<const GLvoid*>(indexStart * indexSize));
         break;
     }
     
@@ -704,12 +704,12 @@ void Graphics::DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned i
         primitiveCount = indexCount / 3;
         if (indexSize == sizeof(unsigned short))
         {
-            glDrawElementsInstancedARB(GL_TRIANGLES, indexCount, GL_UNSIGNED_SHORT, (const GLvoid*)(indexStart * indexSize),
+            glDrawElementsInstancedARB(GL_TRIANGLES, indexCount, GL_UNSIGNED_SHORT, reinterpret_cast<const GLvoid*>(indexStart * indexSize),
                 instanceCount);
         }
         else
         {
-            glDrawElementsInstancedARB(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, (const GLvoid*)(indexStart * indexSize),
+            glDrawElementsInstancedARB(GL_TRIANGLES, indexCount, GL_UNSIGNED_INT, reinterpret_cast<const GLvoid*>(indexStart * indexSize),
                 instanceCount);
         }
         break;
@@ -718,12 +718,12 @@ void Graphics::DrawInstanced(PrimitiveType type, unsigned indexStart, unsigned i
         primitiveCount = indexCount / 2;
         if (indexSize == sizeof(unsigned short))
         {
-            glDrawElementsInstancedARB(GL_LINES, indexCount, GL_UNSIGNED_SHORT, (const GLvoid*)(indexStart * indexSize),
+            glDrawElementsInstancedARB(GL_LINES, indexCount, GL_UNSIGNED_SHORT, reinterpret_cast<const GLvoid*>(indexStart * indexSize),
                 instanceCount);
         }
         else
         {
-            glDrawElementsInstancedARB(GL_LINES, indexCount, GL_UNSIGNED_INT, (const GLvoid*)(indexStart * indexSize),
+            glDrawElementsInstancedARB(GL_LINES, indexCount, GL_UNSIGNED_INT, reinterpret_cast<const GLvoid*>(indexStart * indexSize),
                 instanceCount);
         }
         break;
@@ -812,7 +812,7 @@ bool Graphics::SetVertexBuffers(const Vector<VertexBuffer*>& buffers, const PODV
                 // Set the attribute pointer. Add instance offset for the instance matrix pointers
                 unsigned offset = j >= ELEMENT_INSTANCEMATRIX1 ? instanceOffset * vertexSize : 0;
                 glVertexAttribPointer(attrIndex, VertexBuffer::elementComponents[j], VertexBuffer::elementType[j],
-                    VertexBuffer::elementNormalize[j], vertexSize, (const GLvoid*)(buffer->GetElementOffset((VertexElement)j)
+                    VertexBuffer::elementNormalize[j], vertexSize, reinterpret_cast<const GLvoid*>(buffer->GetElementOffset((VertexElement)j)
                     + offset));
             }
         }
@@ -910,7 +910,7 @@ bool Graphics::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer> >& buffers,
                 // Set the attribute pointer. Add instance offset for the instance matrix pointers
                 unsigned offset = j >= ELEMENT_INSTANCEMATRIX1 ? instanceOffset * vertexSize : 0;
                 glVertexAttribPointer(attrIndex, VertexBuffer::elementComponents[j], VertexBuffer::elementType[j],
-                    VertexBuffer::elementNormalize[j], vertexSize, (const GLvoid*)(buffer->GetElementOffset((VertexElement)j)
+                    VertexBuffer::elementNormalize[j], vertexSize, reinterpret_cast<const GLvoid*>(buffer->GetElementOffset((VertexElement)j)
                     + offset));
             }
         }