Ver Fonte

Fixed xcode warnings for MacOSX

seanpaultaylor há 12 anos atrás
pai
commit
5211d8243e

+ 0 - 34
samples/browser/src/MeshPrimitiveSample.cpp

@@ -148,40 +148,6 @@ static Mesh* createLinesMesh()
 }
 
 
-static Mesh* createPointsMesh()
-{
-    float scale = 0.2f;
-    unsigned int vertexCount = 100;
-
-    std::vector<float> vertices;
-    vertices.reserve(vertexCount * 6);
-    for (unsigned int i = 0; i < vertexCount; ++i)
-    {
-        // x, y, z, r, g, b
-        vertices.push_back(MATH_RANDOM_MINUS1_1() * scale);
-        vertices.push_back(MATH_RANDOM_MINUS1_1() * scale);
-        vertices.push_back(MATH_RANDOM_MINUS1_1() * scale);
-        vertices.push_back(MATH_RANDOM_0_1());
-        vertices.push_back(MATH_RANDOM_0_1());
-        vertices.push_back(MATH_RANDOM_0_1()); 
-    }
-    
-    VertexFormat::Element elements[] =
-    {
-        VertexFormat::Element(VertexFormat::POSITION, 3),
-        VertexFormat::Element(VertexFormat::COLOR, 3)
-    };
-    Mesh* mesh = Mesh::createMesh(VertexFormat(elements, 2), vertexCount, false);
-    if (mesh == NULL)
-    {
-        GP_ERROR("Failed to create mesh.");
-        return NULL;
-    }
-    mesh->setPrimitiveType(Mesh::POINTS);
-    mesh->setVertexData(&vertices[0], 0, vertexCount);
-    return mesh;
-}
-
 MeshPrimitiveSample::MeshPrimitiveSample()
     : _font(NULL), _triangles(NULL), _triangleStrip(NULL), _lineStrip(NULL), _lines(NULL), _points(NULL)
 {

+ 0 - 35
samples/browser/src/SpriteBatchSample.cpp

@@ -5,41 +5,6 @@
     ADD_SAMPLE("Graphics", "Sprite Batch", SpriteBatchSample, 8);
 #endif
 
-/**
- * Creates a triangle mesh with vertex colors.
- */
-static Mesh* createTriangleMesh()
-{
-    // Calculate the vertices of the equilateral triangle.
-    float a = 0.5f;        // length of the side
-    Vector2 p1(0.0f,       a / sqrtf(3.0f));
-    Vector2 p2(-a / 2.0f, -a / (2.0f * sqrtf(3.0f)));
-    Vector2 p3( a / 2.0f, -a / (2.0f * sqrtf(3.0f)));
-
-    // Create 3 vertices.
-    // Each vertex has position (x, y, z) and color (red, green, blue)
-    float vertices[] =
-    {
-        p1.x, p1.y, 0.0f,     1.0f, 0.0f, 0.0f,
-        p2.x, p2.y, 0.0f,     0.0f, 1.0f, 0.0f, 
-        p3.x, p3.y, 0.0f,     0.0f, 0.0f, 1.0f,
-    };
-    unsigned int vertexCount = 3;
-    VertexFormat::Element elements[] =
-    {
-        VertexFormat::Element(VertexFormat::POSITION, 3),
-        VertexFormat::Element(VertexFormat::COLOR, 3)
-    };
-    Mesh* mesh = Mesh::createMesh(VertexFormat(elements, 2), vertexCount, false);
-    if (mesh == NULL)
-    {
-        GP_ERROR("Failed to create mesh.");
-        return NULL;
-    }
-    mesh->setPrimitiveType(Mesh::TRIANGLES);
-    mesh->setVertexData(vertices, 0, vertexCount);
-    return mesh;
-}
 
 SpriteBatchSample::SpriteBatchSample()
     : _font(NULL), _spriteBatch(NULL)

+ 35 - 35
samples/particles/src/ParticlesGame.cpp

@@ -15,7 +15,7 @@ ParticlesGame::ParticlesGame() : _scene(NULL), _panning(false), _rotating(false)
 {
 }
 
-void addGrid(unsigned int lineCount)
+void ParticlesGame::addGrid(unsigned int lineCount)
 {
     float z = -1;
 
@@ -317,61 +317,61 @@ std::string ParticlesGame::openFile(const char* title, const char* filterDescrip
     return "";
 }
 
-std::string toString(ParticleEmitter::TextureBlending blending)
+std::string ParticlesGame::toString(bool b)
 {
-    switch (blending)
-    {
-    case ParticleEmitter::BLEND_OPAQUE:
-        return "OPAQUE";
-    case ParticleEmitter::BLEND_TRANSPARENT:
-        return "TRANSPARENT";
-    case ParticleEmitter::BLEND_ADDITIVE:
-        return "ADDITIVE";
-    case ParticleEmitter::BLEND_MULTIPLIED:
-        return "MULTIPLIED";
-    default:
-        return "TRANSPARENT";
-    }
+    return b ? "true" : "false";
 }
 
-std::string toString(const Vector4& v)
+std::string ParticlesGame::toString(int i)
 {
-    std::ostringstream s;
-    s << v.x << ", " << v.y << ", " << v.z << ", " << v.w;
-    return s.str();
+    char buf[1024];
+    sprintf(buf, "%d", i);
+    return buf;
 }
 
-std::string toString(const Vector3& v)
+std::string ParticlesGame::toString(unsigned int i)
 {
-    std::ostringstream s;
-    s << v.x << ", " << v.y << ", " << v.z;
-    return s.str();
+    char buf[1024];
+    sprintf(buf, "%d", i);
+    return buf;
 }
 
-std::string toString(const Quaternion& q)
+std::string ParticlesGame::toString(const Vector3& v)
 {
     std::ostringstream s;
-    s << q.x << ", " << q.y << ", " << q.z << ", " << q.w;
+    s << v.x << ", " << v.y << ", " << v.z;
     return s.str();
 }
 
-std::string toString(bool b)
+std::string ParticlesGame::toString(const Vector4& v)
 {
-    return b ? "true" : "false";
+    std::ostringstream s;
+    s << v.x << ", " << v.y << ", " << v.z << ", " << v.w;
+    return s.str();
 }
 
-std::string toString(int i)
+std::string ParticlesGame::toString(const Quaternion& q)
 {
-    char buf[1024];
-    sprintf(buf, "%d", i);
-    return buf;
+    std::ostringstream s;
+    s << q.x << ", " << q.y << ", " << q.z << ", " << q.w;
+    return s.str();
 }
 
-std::string toString(unsigned int i)
+std::string ParticlesGame::toString(ParticleEmitter::TextureBlending blending)
 {
-    char buf[1024];
-    sprintf(buf, "%d", i);
-    return buf;
+    switch (blending)
+    {
+        case ParticleEmitter::BLEND_OPAQUE:
+            return "OPAQUE";
+        case ParticleEmitter::BLEND_TRANSPARENT:
+            return "TRANSPARENT";
+        case ParticleEmitter::BLEND_ADDITIVE:
+            return "ADDITIVE";
+        case ParticleEmitter::BLEND_MULTIPLIED:
+            return "MULTIPLIED";
+        default:
+            return "TRANSPARENT";
+    }
 }
 
 void ParticlesGame::saveFile()

+ 16 - 0
samples/particles/src/ParticlesGame.h

@@ -85,6 +85,22 @@ private:
     void updateImageControl();
 
     void updateFrames();
+    
+    void addGrid(unsigned int lineCount);
+    
+    std::string toString(bool b);
+    
+    std::string toString(int i);
+    
+    std::string toString(unsigned int i);
+    
+    std::string toString(const Vector3& v);
+    
+    std::string toString(const Vector4& v);
+    
+    std::string toString(const Quaternion& q);
+    
+    std::string toString(ParticleEmitter::TextureBlending blending);
 
     Scene* _scene;
     Node* _particleEmitterNode;