2
0
Эх сурвалжийг харах

Adding tiling value to ScenePrimitives. Except Ico- and Octosphere.

Joachim Meyer 10 жил өмнө
parent
commit
a2c0e73a5e

+ 9 - 9
Core/Contents/Include/PolyMesh.h

@@ -131,14 +131,14 @@ namespace Polycode {
 			* @param w Width of plane.
 			* @param h Depth of plane.			
 			*/ 
-			void createPlane(Number w, Number h);
+			void createPlane(Number w, Number h, Number tilingValue = 1.0);
 			
 			/**
 			* Creates a vertical plane mesh of specified size.
 			* @param w Width of plane.
 			* @param h Depth of plane.			
 			*/ 
-			void createVPlane(Number w, Number h);
+			void createVPlane(Number w, Number h, Number tilingValue = 1.0);
 
 			/**
 			* Creates a 2D circle.
@@ -146,7 +146,7 @@ namespace Polycode {
 			* @param h Height of plane.			
 			* @param numSegments Number of segments 			
 			*/ 
-			void createCircle(Number w, Number h, unsigned int numSegments);
+			void createCircle(Number w, Number h, unsigned int numSegments, Number tilingValue = 1.0);
 
             /**
              * Creates a 2D circle with normals pointing outwards from vertices.
@@ -154,7 +154,7 @@ namespace Polycode {
              * @param h Height of plane.
              * @param numSegments Number of segments
              */
-            void createLineCircle(Number w, Number h, unsigned int numSegments);
+			void createLineCircle(Number w, Number h, unsigned int numSegments, Number tilingValue = 1.0);
 
 			/**
 			* Creates a torus.
@@ -163,7 +163,7 @@ namespace Polycode {
 			* @param rSegments Number of radial segments.
 			* @param tSegments Number of tube segments.
 			*/ 	
-			void createTorus(Number radius, Number tubeRadius, int segmentsW, int segmentsH);
+			void createTorus(Number radius, Number tubeRadius, int segmentsW, int segmentsH, Number tilingValue = 1.0);
 			
 			/**
 			* Creates a cube mesh of specified size.
@@ -171,7 +171,7 @@ namespace Polycode {
 			* @param d Depth of cube.			
 			* @param h Height of cube.
 			*/ 			
-			void createBox(Number w, Number d, Number h);
+			void createBox(Number w, Number d, Number h, Number tilingValue = 1.0);
 			
 			/**
 			* Creates a sphere mesh of specified size.
@@ -179,7 +179,7 @@ namespace Polycode {
 			* @param numRings Number of rings.	
 			* @param numSegments Number of segments.
 			*/ 						
-			void createSphere(Number radius, int numRings, int numSegments);
+			void createSphere(Number radius, int numRings, int numSegments, Number tilingValue = 1.0);
 
 			/**
 			* Creates an icosphere of specified radius
@@ -202,7 +202,7 @@ namespace Polycode {
 			* @param numSegments Number of segments.
 			* @param capped Create the end caps.
 			*/ 								
-			void createCylinder(Number height, Number radius, int numSegments, bool capped=true);
+			void createCylinder(Number height, Number radius, int numSegments, bool capped = true, Number tilingValue = 1.0);
 
 			/**
 			* Creates a cone mesh.
@@ -210,7 +210,7 @@ namespace Polycode {
 			* @param radius Radius of the cone.
 			* @param numSegments Number of segments.
 			*/ 								
-			void createCone(Number height, Number radius, int numSegments);
+			void createCone(Number height, Number radius, int numSegments, Number tilingValue = 1.0);
 
 		
 			/**

+ 16 - 6
Core/Contents/Include/PolyScenePrimitive.h

@@ -43,10 +43,10 @@ namespace Polycode {
 			* @param v4 See the constant primitive types for values for these parameters									
 			* @param v5 See the constant primitive types for values for these parameters												
 			*/
-			ScenePrimitive(int type, Number v1=1.0f, Number v2=1.0f, Number v3=1.0f,Number v4=0.0f,Number v5=0.0f);
+			ScenePrimitive(int type, Number v1=1.0f, Number v2=1.0f, Number v3=1.0f,Number v4=1.0f,Number v5=1.0f);
 			virtual ~ScenePrimitive();
 
-			void setPrimitiveOptions(int type, Number v1=1.0f, Number v2=1.0f, Number v3=1.0f,Number v4=0.0f,Number v5=0.0f);
+			void setPrimitiveOptions(int type, Number v1=1.0f, Number v2=1.0f, Number v3=1.0f,Number v4=1.0f,Number v5=1.0f);
 
 			void recreatePrimitive();
 		
@@ -54,14 +54,16 @@ namespace Polycode {
 			* A cube.
 			* v1 - X size
 			* v2 - Y size
-			* v3 - Z size						
+			* v3 - Z size
+			* v4 - # of tiles
 			*/
 			static const int TYPE_BOX = 0;		
 
 			/**
 			* A horizontal plane.
 			* v1 - X size
-			* v2 - Z size			
+			* v2 - Z size
+			* v3 - # of tiles
 			*/			
 			static const int TYPE_PLANE = 1;			
 
@@ -69,6 +71,7 @@ namespace Polycode {
              * A vertical plane.
              * v1 - X size
              * v2 - Y size
+			 * v3 - # of tiles
              */
             static const int TYPE_VPLANE = 2;
         
@@ -77,6 +80,7 @@ namespace Polycode {
 			* v1 - Cylinder length			
 			* v2 - Cylinder radius
 			* v3 - Number of segments.
+			* v4 - # of tiles
 			*/			
 			static const int TYPE_CYLINDER = 3;
 
@@ -85,6 +89,7 @@ namespace Polycode {
              * v1 - Cylinder length
              * v2 - Cylinder radius
              * v3 - Number of segments.
+			 * v4 - # of tiles
              */
             static const int TYPE_UNCAPPED_CYLINDER = 4;
 
@@ -93,6 +98,7 @@ namespace Polycode {
              * v1 - Sphere radius
              * v2 - Lat segments
              * v3 - Long segments
+			 * v4 - # of tiles
              */
             static const int TYPE_SPHERE = 5;
 
@@ -101,7 +107,8 @@ namespace Polycode {
 			* v1 - Torus radius.
 			* v2 - Pipe radius.
 			* v3 - Number of ring segments.			
-			* v4- Number of pipe segments.
+			* v4 - Number of pipe segments.
+			* v5 - # of tiles
 			*/			
 			static const int TYPE_TORUS = 6;	
 			     
@@ -110,6 +117,7 @@ namespace Polycode {
              * v1 - Cone length.
              * v2 - Cone raidus.
              * v3 - Number of segments.
+			 * v4 - # of tiles
              */
             static const int TYPE_CONE = 7;
 
@@ -118,6 +126,7 @@ namespace Polycode {
 			* v1 - X size
 			* v2 - Y size
 			* v3 - Number of segments
+			* v4 - # of tiles
 			*/			
 			static const int TYPE_CIRCLE = 8;			
         
@@ -140,6 +149,7 @@ namespace Polycode {
              * v1 - X size
              * v2 - Y size
              * v3 - Number of segments
+			 * v4 - # of tiles
              */
             static const int TYPE_LINE_CIRCLE = 11;
 
@@ -162,7 +172,7 @@ namespace Polycode {
 			Number v2;
 			Number v3;
 			Number v4;
-			Number v5;			
+			Number v5;
 												
 	};
 	

+ 63 - 63
Core/Contents/Source/PolyMesh.cpp

@@ -519,7 +519,7 @@ void Mesh::loadMesh(const String& fileName) {
     OSBasics::close(inFile);	
 }
 
-void Mesh::createCircle(Number w, Number h, unsigned int numSegments) {
+void Mesh::createCircle(Number w, Number h, unsigned int numSegments, Number tilingValue) {
     setMeshType(Mesh::TRI_MESH);
     indexedMesh = false;
 
@@ -534,9 +534,9 @@ void Mesh::createCircle(Number w, Number h, unsigned int numSegments) {
         Number y = cos(pos) * h * 0.5;
         
         if(i > 0) {
-            addVertexWithUVAndNormal(0,0,0,0.5,0.5, 0.0, 0.0, 1.0);
-            addVertexWithUVAndNormal(x,y,0, 0.5+(y/h*0.5), 0.5+(x/w*0.5), 0.0, 0.0, 1.0);
-            addVertexWithUVAndNormal(lastx,lasty,0, 0.5+(lasty/h*0.5), 0.5+(lastx/w*0.5), 0.0, 0.0, 1.0);
+			addVertexWithUVAndNormal(0, 0, 0, 0.5*tilingValue, 0.5*tilingValue, 0.0, 0.0, 1.0);
+			addVertexWithUVAndNormal(x, y, 0, (0.5 + (y / h*0.5))*tilingValue, (0.5 + (x / w*0.5))*tilingValue, 0.0, 0.0, 1.0);
+			addVertexWithUVAndNormal(lastx, lasty, 0, (0.5 + (lasty / h*0.5))*tilingValue, (0.5 + (lastx / w*0.5))*tilingValue, 0.0, 0.0, 1.0);
         }
         lastx = x;
         lastv = v;
@@ -551,7 +551,7 @@ Mesh *Mesh::Copy() const {
     return newMesh;
 }
 
-void Mesh::createLineCircle(Number w, Number h, unsigned int numSegments) {
+void Mesh::createLineCircle(Number w, Number h, unsigned int numSegments, Number tilingValue) {
     setMeshType(Mesh::TRIFAN_MESH);
     indexedMesh = false;
     
@@ -562,7 +562,7 @@ void Mesh::createLineCircle(Number w, Number h, unsigned int numSegments) {
         step = 1;
     }
     
-    addVertexWithUV(cosf(0)*(w/2),sinf(0)*(h/2), 0, (cosf(0)*0.5) + 0.5,(sinf(0) * 0.5)+ 0.5);
+	addVertexWithUV(cosf(0)*(w / 2), sinf(0)*(h / 2), 0, ((cosf(0)*0.5) + 0.5)*tilingValue, ((sinf(0) * 0.5) + 0.5)*tilingValue);
     addNormal(0.0, 0.0, 0.0);
     
     for (int i=0; i < 361; i+= step) {
@@ -571,7 +571,7 @@ void Mesh::createLineCircle(Number w, Number h, unsigned int numSegments) {
         Number x = cos(degInRad)*(w/2);
         Number y = sin(degInRad)*(h/2);
         
-        addVertexWithUV(x, y, 0, (cos(degInRad) * 0.5)+ 0.5 , 1.0- ((sin(degInRad) * 0.5)+ 0.5));
+		addVertexWithUV(x, y, 0, ((cos(degInRad) * 0.5) + 0.5)*tilingValue, (1.0 - ((sin(degInRad) * 0.5) + 0.5))*tilingValue);
         
         Vector3 normal(x,y, 0.0);
         normal.Normalize();
@@ -579,33 +579,33 @@ void Mesh::createLineCircle(Number w, Number h, unsigned int numSegments) {
     }
 }
 
-void Mesh::createVPlane(Number w, Number h) {
+void Mesh::createVPlane(Number w, Number h, Number tilingValue) {
     setMeshType(Mesh::TRI_MESH);
     indexedMesh = false;
     
     addVertexWithUVAndNormal(0 - (w/2.0f),0 - (h/2.0f), 0,0,0, 0.0, 0.0, 1.0);
-    addVertexWithUVAndNormal(w - (w/2.0f), 0- (h/2.0f), 0, 1, 0, 0.0, 0.0, 1.0);
-    addVertexWithUVAndNormal(w- (w/2.0f), h- (h/2.0f), 0, 1, 1, 0.0, 0.0, 1.0);
+    addVertexWithUVAndNormal(w - (w/2.0f), 0- (h/2.0f), 0, tilingValue, 0, 0.0, 0.0, 1.0);
+    addVertexWithUVAndNormal(w- (w/2.0f), h- (h/2.0f), 0, tilingValue, tilingValue, 0.0, 0.0, 1.0);
     
     addVertexWithUVAndNormal(0 - (w/2.0f),0- (h/2.0f), 0,0,0, 0.0, 0.0, 1.0);
-    addVertexWithUVAndNormal(w - (w/2.0f),h - (h/2.0f), 0, 1, 1, 0.0, 0.0, 1.0);
-    addVertexWithUVAndNormal(0 - (w/2.0f),h - (h/2.0f), 0,0,1, 0.0, 0.0, 1.0);
+    addVertexWithUVAndNormal(w - (w/2.0f),h - (h/2.0f), 0, tilingValue, tilingValue, 0.0, 0.0, 1.0);
+	addVertexWithUVAndNormal(0 - (w / 2.0f), h - (h / 2.0f), 0, 0, tilingValue, 0.0, 0.0, 1.0);
     
     calculateNormals();
     calculateTangents();
 }	
 
-void Mesh::createPlane(Number w, Number h) {
+void Mesh::createPlane(Number w, Number h, Number tilingValue) {
     setMeshType(Mesh::TRI_MESH);
     indexedMesh = false;
     
-    addVertexWithUV(0- (w/2.0f),0,h- (h/2.0f),0,0);
-    addVertexWithUV(w- (w/2.0f),0,h- (h/2.0f), 1, 0);
-    addVertexWithUV(w- (w/2.0f),0,0- (h/2.0f), 1, 1);
+	addVertexWithUV(0 - (w / 2.0f), 0, h - (h / 2.0f), 0, 0);
+	addVertexWithUV(w - (w / 2.0f), 0, h - (h / 2.0f), 1 * tilingValue, 0);
+	addVertexWithUV(w - (w / 2.0f), 0, 0 - (h / 2.0f), 1 * tilingValue, 1 * tilingValue);
     
-    addVertexWithUV(0- (w/2.0f),0,h- (h/2.0f),0,0);
-    addVertexWithUV(w- (w/2.0f),0,0- (h/2.0f), 1, 1);
-    addVertexWithUV(0- (w/2.0f),0,0- (h/2.0f),0,1);
+	addVertexWithUV(0 - (w / 2.0f), 0, h - (h / 2.0f), 0, 0);
+	addVertexWithUV(w - (w / 2.0f), 0, 0 - (h / 2.0f), 1 * tilingValue, 1 * tilingValue);
+	addVertexWithUV(0 - (w / 2.0f), 0, 0 - (h / 2.0f), 0, 1 * tilingValue);
 
     calculateNormals();
     calculateTangents();
@@ -674,7 +674,7 @@ Vector3 Mesh::calculateBBox() {
     return retVec*2;
 }
 
-void Mesh::createSphere(Number radius, int segmentsH, int segmentsW) {
+void Mesh::createSphere(Number radius, int segmentsH, int segmentsW, Number tilingValue) {
 
     segmentsH++;
     segmentsW++;
@@ -697,7 +697,7 @@ void Mesh::createSphere(Number radius, int segmentsH, int segmentsW) {
             addVertex(v.x, v.y, v.z);
             v.Normalize();
             addNormal(v.x, v.y, v.z);
-            addTexCoord(-theta/(360.f) , (phi+90.f)/180.f);
+			addTexCoord((-theta / (360.f))*tilingValue, ((phi + 90.f) / 180.f)*tilingValue);
             theta += tdelta;
         }
         phi += pdelta;
@@ -896,7 +896,7 @@ unsigned int Mesh::getIndexCount() {
     return indexArray.data.size();
 }
 
-void Mesh::createTorus(Number radius, Number tubeRadius, int segmentsW, int segmentsH) {
+void Mesh::createTorus(Number radius, Number tubeRadius, int segmentsW, int segmentsH, Number tilingValue) {
 
     segmentsH++;
     segmentsW++;
@@ -919,7 +919,7 @@ void Mesh::createTorus(Number radius, Number tubeRadius, int segmentsW, int segm
             v.z = (radius + tubeRadius*cos(phi*TORADIANS))*sin(theta*TORADIANS);
             
             addVertex(v.x, v.y, v.z);
-            addTexCoord(-theta/(360.f) , (phi/(360.f)) + 0.5);
+			addTexCoord((-theta / (360.f))*tilingValue, ((phi / (360.f)) + 0.5)*tilingValue);
             theta += tdelta;
         }
         phi += pdelta;
@@ -937,7 +937,7 @@ void Mesh::createTorus(Number radius, Number tubeRadius, int segmentsW, int segm
     calculateTangents();
 }
 
-void Mesh::createCylinder(Number height, Number radius, int numSegments, bool capped) {
+void Mesh::createCylinder(Number height, Number radius, int numSegments, bool capped, Number tilingValue) {
 
     setMeshType(Mesh::TRI_MESH);
     indexedMesh = true;
@@ -949,8 +949,8 @@ void Mesh::createCylinder(Number height, Number radius, int numSegments, bool ca
     numSegments++;
     
     if(capped) {
-        addVertexWithUVAndNormal(0,0 - (height/2.0f),0,0.5,0.5, 0.0, -1.0, 0.0);
-        addVertexWithUVAndNormal(0,height - (height/2.0f),0,0.5,0.5, 0.0, 1.0, 0.0);
+		addVertexWithUVAndNormal(0, 0 - (height / 2.0f), 0, 0.5*tilingValue, 0.5*tilingValue, 0.0, -1.0, 0.0);
+		addVertexWithUVAndNormal(0, height - (height / 2.0f), 0, 0.5*tilingValue, 0.5*tilingValue, 0.0, 1.0, 0.0);
     }
     
     for (int i=0 ; i < numSegments; i++) {
@@ -959,12 +959,12 @@ void Mesh::createCylinder(Number height, Number radius, int numSegments, bool ca
         Number x = sin(pos);
         Number z = cos(pos);
         
-        addVertexWithUVAndNormal(x*radius,0 - (height/2.0f),z*radius, v, 0, x, 0, z);
-        addVertexWithUVAndNormal(x*radius,height - (height/2.0f),z*radius, v, 1, x,0,z);
+		addVertexWithUVAndNormal(x*radius, 0 - (height / 2.0f), z*radius, v*tilingValue, 0, x, 0, z);
+		addVertexWithUVAndNormal(x*radius, height - (height / 2.0f), z*radius, v*tilingValue, tilingValue, x, 0, z);
         
         if(capped) {
-            addVertexWithUVAndNormal(x*radius,0 - (height/2.0f),z*radius, 0.5+(z*0.5), 0.5+(x*0.5), 0.0, -1.0, 0.0);
-            addVertexWithUVAndNormal(x*radius,height - (height/2.0f),z*radius, 0.5+(z*0.5), 0.5+(x*0.5), 0.0, 1.0, 0.0);
+			addVertexWithUVAndNormal(x*radius, 0 - (height / 2.0f), z*radius, (0.5 + (z*0.5))*tilingValue, (0.5 + (x*0.5))*tilingValue, 0.0, -1.0, 0.0);
+			addVertexWithUVAndNormal(x*radius, height - (height / 2.0f), z*radius, (0.5 + (z*0.5))*tilingValue, (0.5 + (x*0.5))*tilingValue, 0.0, 1.0, 0.0);
         }
 
         lastx = x;
@@ -996,7 +996,7 @@ void Mesh::createCylinder(Number height, Number radius, int numSegments, bool ca
     calculateTangents();
 }
 
-void Mesh::createCone(Number height, Number radius, int numSegments) {
+void Mesh::createCone(Number height, Number radius, int numSegments, Number tilingValue) {
     
     setMeshType(Mesh::TRI_MESH);
     indexedMesh = true;
@@ -1010,7 +1010,7 @@ void Mesh::createCone(Number height, Number radius, int numSegments) {
         numSegments++;
     }
     
-    addVertexWithUVAndNormal(0,0- (height/2.0f),0,0.5,0.5, 0.0, -1.0, 0.0);
+	addVertexWithUVAndNormal(0, 0 - (height / 2.0f), 0, 0.5*tilingValue, 0.5*tilingValue, 0.0, -1.0, 0.0);
     
     for (int i=0 ; i < numSegments; i++) {
         Number pos = ((PI*2.0)/((Number)numSegments-1)) * i;
@@ -1018,10 +1018,10 @@ void Mesh::createCone(Number height, Number radius, int numSegments) {
         Number z = cos(pos);
 
         if(!(i % 2)) {
-            addVertexWithUVAndNormal(x*radius,0- (height/2.0f),z*radius, 0.5+(z*0.5), 0.5+(x*0.5), x, 0.0, z);
-            addVertexWithUVAndNormal(x*radius,0- (height/2.0f),z*radius, 0.5+(z*0.5), 0.5+(x*0.5), 0.0, -1.0, 0.0);
+			addVertexWithUVAndNormal(x*radius, 0 - (height / 2.0f), z*radius, (0.5 + (z*0.5))*tilingValue, (0.5 + (x*0.5))*tilingValue, x, 0.0, z);
+			addVertexWithUVAndNormal(x*radius, 0 - (height / 2.0f), z*radius, (0.5 + (z*0.5))*tilingValue, (0.5 + (x*0.5))*tilingValue, 0.0, -1.0, 0.0);
         } else {
-            addVertexWithUVAndNormal(0,height- (height/2.0f),0, 0.5, 0.5, 0.0, 1.0, 0.0);
+			addVertexWithUVAndNormal(0, height - (height / 2.0f), 0, 0.5*tilingValue, 0.5*tilingValue, 0.0, 1.0, 0.0);
         }
         
         lastx = x;
@@ -1134,56 +1134,56 @@ int Mesh::removeUnusedVertices() {
 	return removals;
 }
 
-void Mesh::createBox(Number w, Number d, Number h) {
+void Mesh::createBox(Number w, Number d, Number h, Number tilingValue) {
     setMeshType(Mesh::TRI_MESH);
     indexedMesh = false;
     
-    addVertexWithUV(w,0,h, 1, 1);
-    addVertexWithUV(0,0,h, 1, 0);
+    addVertexWithUV(w,0,h, tilingValue, tilingValue);
+    addVertexWithUV(0,0,h, tilingValue, 0);
     addVertexWithUV(0,0,0,0,0);
     
-    addVertexWithUV(w,0,h, 1, 1);
+    addVertexWithUV(w,0,h, tilingValue, tilingValue);
     addVertexWithUV(0,0,0,0,0);
-    addVertexWithUV(w,0,0,0,1);
+    addVertexWithUV(w,0,0,0,tilingValue);
     
-    addVertexWithUV(w,d,h, 1, 1);
-    addVertexWithUV(w,d,0, 1, 0);
+    addVertexWithUV(w,d,h, tilingValue, tilingValue);
+    addVertexWithUV(w,d,0, tilingValue, 0);
     addVertexWithUV(0,d,0,0,0);
     
-    addVertexWithUV(w,d,h, 1, 1);
+    addVertexWithUV(w,d,h, tilingValue, tilingValue);
     addVertexWithUV(0,d,0,0,0);
-    addVertexWithUV(0,d,h,0,1);
+    addVertexWithUV(0,d,h,0,tilingValue);
     
-    addVertexWithUV(0,d,0,0,1);
-    addVertexWithUV(w,d,0, 1, 1);
-    addVertexWithUV(w,0,0, 1, 0);
+    addVertexWithUV(0,d,0,0,tilingValue);
+    addVertexWithUV(w,d,0, tilingValue, tilingValue);
+    addVertexWithUV(w,0,0, tilingValue, 0);
     
-    addVertexWithUV(0,d,0,0,1);
-    addVertexWithUV(w,0,0, 1, 0);
+    addVertexWithUV(0,d,0,0,tilingValue);
+    addVertexWithUV(w,0,0, tilingValue, 0);
     addVertexWithUV(0,0,0,0,0);
     
     addVertexWithUV(0,0,h,0,0);
-    addVertexWithUV(w,0,h, 1, 0);
-    addVertexWithUV(w,d,h, 1, 1);
+    addVertexWithUV(w,0,h, tilingValue, 0);
+    addVertexWithUV(w,d,h, tilingValue, tilingValue);
     
     addVertexWithUV(0,0,h,0,0);
-    addVertexWithUV(w,d,h, 1, 1);
-    addVertexWithUV(0,d,h,0,1);
+    addVertexWithUV(w,d,h, tilingValue, tilingValue);
+    addVertexWithUV(0,d,h,0,tilingValue);
     
-    addVertexWithUV(0,0,h,0,1);
-    addVertexWithUV(0,d,h, 1, 1);
-    addVertexWithUV(0,d,0, 1, 0);
+    addVertexWithUV(0,0,h,0,tilingValue);
+    addVertexWithUV(0,d,h, tilingValue, tilingValue);
+    addVertexWithUV(0,d,0, tilingValue, 0);
     
-    addVertexWithUV(0,0,h,0,1);
-    addVertexWithUV(0,d,0, 1, 0);
+    addVertexWithUV(0,0,h,0,tilingValue);
+    addVertexWithUV(0,d,0, tilingValue, 0);
     addVertexWithUV(0,0,0,0,0);
     
-    addVertexWithUV(w,0,h,0,1);
-    addVertexWithUV(w,0,0, 1, 1);
-    addVertexWithUV(w,d,0, 1, 0);
+    addVertexWithUV(w,0,h,0,tilingValue);
+    addVertexWithUV(w,0,0, tilingValue, tilingValue);
+    addVertexWithUV(w,d,0, tilingValue, 0);
     
-    addVertexWithUV(w,0,h,0,1);
-    addVertexWithUV(w,d,0, 1, 0);
+    addVertexWithUV(w,0,h,0,tilingValue);
+    addVertexWithUV(w,d,0, tilingValue, 0);
     addVertexWithUV(w,d,h,0,0);
     
     for(int i=0; i < vertexPositionArray.data.size()-2; i += 3) {

+ 11 - 11
Core/Contents/Source/PolyScenePrimitive.cpp

@@ -33,7 +33,7 @@ ScenePrimitive::ScenePrimitive(int type, Number v1, Number v2, Number v3,Number
 	this->v3 = v3;
 	this->v4 = v4;
 	this->v5 = v5;
-	
+
 	recreatePrimitive();
 }
 
@@ -65,43 +65,43 @@ void ScenePrimitive::recreatePrimitive() {
 	mesh->clearMesh();
 	switch(type) {
 		case TYPE_PLANE:
-			mesh->createPlane(v1,v2);
+			mesh->createPlane(v1, v2, v3);
             setLocalBoundingBox(v1, 0.001, v2);
 		break;
 		case TYPE_VPLANE:
-			mesh->createVPlane(v1,v2);
+			mesh->createVPlane(v1, v2, v3);
             setLocalBoundingBox(v1, v2, 0.001);
 		break;
 		case TYPE_BOX:
-			mesh->createBox(v1,v2,v3);
+			mesh->createBox(v1, v2, v3, v4);
             setLocalBoundingBox(v1, v2, v3);
 		break;
 		case TYPE_SPHERE:
-			mesh->createSphere(v1,v2,v3);
+			mesh->createSphere(v1, v2, v3, v4);
             setLocalBoundingBox(v1*2, v1*2, v1*2);
 		break;
 		case TYPE_CYLINDER:
-			mesh->createCylinder(v1,v2,v3);
+			mesh->createCylinder(v1, v2, v3, true, v4);
             setLocalBoundingBox(v2*2, v1, v2*2);
 		break;
 		case TYPE_UNCAPPED_CYLINDER:
-			mesh->createCylinder(v1,v2,v3, false);
+			mesh->createCylinder(v1, v2, v3, false, v5);
             setLocalBoundingBox(v2*2, v1, v2*2);
 		break;
 		case TYPE_CONE:
-			mesh->createCone(v1,v2,v3);
+			mesh->createCone(v1, v2, v3, v4);
             setLocalBoundingBox(v2*2, v1, v2*2);
 		break;
 		case TYPE_TORUS:
-			mesh->createTorus(v1,v2,v3,v4);
+			mesh->createTorus(v1, v2, v3, v4, v5);
             setLocalBoundingBox((v1*2) + (v2*2), v2 * 2, (v1*2) + (v2*2));
 		break;
 		case TYPE_CIRCLE:
-			mesh->createCircle(v1, v2, v3);
+			mesh->createCircle(v1, v2, v3, v4);
             setLocalBoundingBox(v1, v2, 0.001);
 		break;
 		case TYPE_LINE_CIRCLE:
-			mesh->createLineCircle(v1, v2, v3);
+			mesh->createLineCircle(v1, v2, v3, v4);
             setLocalBoundingBox(v1, v2, 0.001);
         break;
 		case TYPE_ICOSPHERE: