Browse Source

Convert back from c++11

nemerle 10 years ago
parent
commit
c479fd72d5

+ 2 - 2
Source/Urho3D/Graphics/Geometry.cpp

@@ -348,10 +348,10 @@ float Geometry::GetHitDistance(const Ray& ray, Vector3* outNormal, Vector2 * out
         if( 0 == (elementMask & MASK_TEXCOORD1) ) {
             // requested UV output, but no texture data in vertex buffer
             LOGWARNING("Illegal GetHitDistance call: UV return requested on vertex buffer without UV coords");
-            outUV = nullptr;
+            outUV = 0;
         }
         else
-            uvOffset = VertexBuffer::GetElementOffset(elementMask,VertexElement::ELEMENT_TEXCOORD1);
+            uvOffset = VertexBuffer::GetElementOffset(elementMask,ELEMENT_TEXCOORD1);
     }
     if (vertexData) {
         if(indexData)

+ 1 - 1
Source/Urho3D/Graphics/Geometry.h

@@ -95,7 +95,7 @@ public:
     /// Return raw vertex and index data for CPU operations, or null pointers if not available.
     void GetRawDataShared(SharedArrayPtr<unsigned char>& vertexData, unsigned& vertexSize, SharedArrayPtr<unsigned char>& indexData, unsigned& indexSize, unsigned& elementMask) const;
     /// Return ray hit distance or infinity if no hit. Requires raw data to be set. Optionally return hit normal.
-    float GetHitDistance(const Ray& ray, Vector3* outNormal = nullptr,Vector2* outUV = nullptr) const;
+    float GetHitDistance(const Ray& ray, Vector3* outNormal = 0,Vector2* outUV = 0) const;
     /// Return whether or not the ray is inside geometry.
     bool IsInside(const Ray& ray) const;
     /// Return whether has empty draw range.

+ 10 - 2
Source/Urho3D/Graphics/OctreeQuery.h

@@ -185,10 +185,18 @@ enum RayQueryLevel
 /// Raycast result.
 struct URHO3D_API RayQueryResult
 {
+    /// Construct with defaults.
+    RayQueryResult() :
+        drawable_(0),
+        node_(0)
+    {
+    }
+
     /// Test for inequality, added to prevent GCC from complaining.
     bool operator != (const RayQueryResult& rhs) const {
         return position_ != rhs.position_ ||
                 normal_ != rhs.normal_ ||
+                texture_uv_ != rhs.texture_uv_ ||
                 distance_ != rhs.distance_ ||
                 drawable_ != rhs.drawable_ ||
                 node_ != rhs.node_ ||
@@ -204,9 +212,9 @@ struct URHO3D_API RayQueryResult
     /// Distance from ray origin.
     float distance_;
     /// Drawable.
-    Drawable* drawable_ = nullptr;
+    Drawable* drawable_;
     /// Scene node.
-    Node* node_ = nullptr;
+    Node* node_;
     /// Drawable specific subobject if applicable.
     unsigned subObject_;
 };

+ 1 - 1
Source/Urho3D/Graphics/StaticModel.cpp

@@ -125,7 +125,7 @@ void StaticModel::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQuer
             result.node_ = node_;
             result.subObject_ = hitBatch;
             result.texture_uv_ = geometryUV;
-            results.push_back(result);
+            results.Push(result);
         }
         break;
     }

+ 4 - 4
Source/Urho3D/Math/Ray.cpp

@@ -203,7 +203,7 @@ float Ray::HitDistance(const Sphere& sphere) const
 
 float Ray::HitDistance(const Vector3& v0, const Vector3& v1, const Vector3& v2) const
 {
-    return HitDistance(v0, v1, v2, nullptr,nullptr);
+    return HitDistance(v0, v1, v2, 0, 0);
 }
 
 float Ray::HitDistance(const Vector3& v0, const Vector3& v1, const Vector3& v2, Vector3* outNormal,Vector3 *outBary) const
@@ -285,7 +285,7 @@ float Ray::HitDistance(const void* vertexData, unsigned vertexStride, unsigned v
             const Vector3& v0 = *((const Vector3*)(&vertices[index * vertexStride]));
             const Vector3& v1 = *((const Vector3*)(&vertices[(index + 1) * vertexStride]));
             const Vector3& v2 = *((const Vector3*)(&vertices[(index + 2) * vertexStride]));
-            nearest = Min(nearest, HitDistance(v0, v1, v2, outNormal,nullptr));
+            nearest = Min(nearest, HitDistance(v0, v1, v2, outNormal,0));
             index += 3;
         }
     }
@@ -369,7 +369,7 @@ float Ray::HitDistance(const void* vertexData, unsigned vertexStride, const void
                 const Vector3& v0 = *((const Vector3*)(&vertices[indices[0] * vertexStride]));
                 const Vector3& v1 = *((const Vector3*)(&vertices[indices[1] * vertexStride]));
                 const Vector3& v2 = *((const Vector3*)(&vertices[indices[2] * vertexStride]));
-                nearest = Min(nearest, HitDistance(v0, v1, v2, outNormal,nullptr));
+                nearest = Min(nearest, HitDistance(v0, v1, v2, outNormal,0));
                 indices += 3;
             }
         }
@@ -384,7 +384,7 @@ float Ray::HitDistance(const void* vertexData, unsigned vertexStride, const void
                 const Vector3& v0 = *((const Vector3*)(&vertices[indices[0] * vertexStride]));
                 const Vector3& v1 = *((const Vector3*)(&vertices[indices[1] * vertexStride]));
                 const Vector3& v2 = *((const Vector3*)(&vertices[indices[2] * vertexStride]));
-                nearest = Min(nearest, HitDistance(v0, v1, v2, outNormal,nullptr));
+                nearest = Min(nearest, HitDistance(v0, v1, v2, outNormal,0));
                 indices += 3;
             }
         }

+ 2 - 2
Source/Urho3D/Math/Ray.h

@@ -104,9 +104,9 @@ public:
     /// Return hit distance to a triangle and out normal, or infinity if no hit.
     float HitDistance(const Vector3& v0, const Vector3& v1, const Vector3& v2, Vector3* outNormal, Vector3 * outBary) const;
     /// Return hit distance to non-indexed geometry data, or infinity if no hit. Optionally return normal, and uv coordinates at intersect point
-    float HitDistance(const void* vertexData, unsigned vertexStride, unsigned vertexStart, unsigned vertexCount, Vector3* outNormal = nullptr, Vector2* outUV1 = nullptr, unsigned uvOffset=0) const;
+    float HitDistance(const void* vertexData, unsigned vertexStride, unsigned vertexStart, unsigned vertexCount, Vector3* outNormal = 0, Vector2* outUV1 = 0, unsigned uvOffset=0) const;
     /// Return hit distance to indexed geometry data, or infinity if no hit.
-    float HitDistance(const void* vertexData, unsigned vertexStride, const void* indexData, unsigned indexSize, unsigned indexStart, unsigned indexCount, Vector3* outNormal = nullptr, Vector2* outUV1 = nullptr, unsigned uvOffset=0) const;
+    float HitDistance(const void* vertexData, unsigned vertexStride, const void* indexData, unsigned indexSize, unsigned indexStart, unsigned indexCount, Vector3* outNormal = 0, Vector2* outUV1 = 0, unsigned uvOffset=0) const;
     /// Return whether ray is inside non-indexed geometry.
     bool InsideGeometry(const void* vertexData, unsigned vertexSize, unsigned vertexStart, unsigned vertexCount) const;
     /// Return whether ray is inside indexed geometry.