<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: mesh - Recent Posts</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/mesh</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 24 May 2013 00:19:15 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/mesh" rel="self" type="application/rss+xml" />

		<item>
			<title>dbdbking on "Sprite deformation"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/341505#post-504085</link>
			<pubDate>Fri, 03 May 2013 10:09:09 +0000</pubDate>
			<dc:creator>dbdbking</dc:creator>
			<guid isPermaLink="false">504085@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, I would like to ask what the best way to deform a sprite dynamically is? </p>
<p>see image below:</p>
<p><img src="https://dl.dropboxusercontent.com/u/6831445/spriteDeform.png" /></p>
<p>Thank you!
</p></description>
		</item>
		<item>
			<title>linked leo on "How to fill a shape with triangles programmatically ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/232506#post-390147</link>
			<pubDate>Sat, 23 Feb 2013 23:48:08 +0000</pubDate>
			<dc:creator>linked leo</dc:creator>
			<guid isPermaLink="false">390147@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Error found, it was a index count problem.<br />
Just replace this line:<br />
<pre><code>int indexIndice = (sizeof(arr_indice)/sizeof(arr_indice[0]));</code></pre>
<p>with this one:<br />
<pre><code>int indexIndice = (sizeof(arr_indice)/sizeof(arr_indice[0]))-1;</code></pre></description>
		</item>
		<item>
			<title>linked leo on "How to fill a shape with triangles programmatically ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/232506#post-389769</link>
			<pubDate>Sat, 23 Feb 2013 15:07:19 +0000</pubDate>
			<dc:creator>linked leo</dc:creator>
			<guid isPermaLink="false">389769@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Well, i have now the triangulation for the height.<br />
The trick is to draw the H shape as flat like previously and draw another H shape below.</p>
<p>After, just draw 2 triangle to fill the square (6 indices per faces)</p>
<p>I know i must set them counter clock wise but something is wrong. Some triangle does not show and other are ok.<br />
I draw them in the same circular way.</p>
<p>For the first triangle:<br />
bottom left, bottom right, top left</p>
<p>Second:<br />
bottom right, top right, top left</p>
<p>Here is the code:<br />
<pre><code>- (void)addBatimentHIn3D{
    static float arr_location[] = {0,0,0, 10,0,0, 10,20,0, 20,20,0, 20,0,0, 30,0,0, 30,50,0, 20,50,0, 20,30,0, 10,30,0, 10,50,0, 0,50,0};

    NSMutableArray *arr_location2 = [[NSMutableArray alloc] init];

    // fill the NSMutableArray with the arr_location data
    for (int item = 0; item &#60; (sizeof(arr_location)/sizeof(arr_location[0])); item++) {
        [arr_location2 addObject:[NSValue valueWithCGPoint:CGPointMake(arr_location[item], arr_location[item+1])]];
        item++;
        item++;

    }

    // get the triangulation points
    NSArray *indices = [self triangulateVertices:arr_location2];
    NSLog(@&#34;indices:%@ count:%i&#34;,indices,[indices count]);

    // correct H except a missing part
    //static ushort arr_indice[] = {3,4,5,5,6,7,9,10,11,5,7,8,3,5,8,2,3,8,2,8,9,2,9,11,1,2,11};

    ushort arr_indice[[indices count]];

    for (int item = 0; item &#60; [indices count]; item++) {
        //NSLog(@&#34;fill indice item:%i&#34;,item);
        for (int loc = 0; loc &#60; [arr_location2 count]; loc++) {
            if (CGPointEqualToPoint([[arr_location2 objectAtIndex:loc] CGPointValue], [[indices objectAtIndex:item] CGPointValue])) {
                NSLog(@&#34;add to indice[%i]:%i&#34;,item,loc);
                arr_indice[item] = loc;
            }
        }
    }

    //NSLog(@&#34;size of NON static indice:%li&#34;, (sizeof(arr_indice)/sizeof(arr_indice[0])));

    CC3VertexArrayMesh *demoMeshModel = [[CC3VertexArrayMesh meshWithName:@&#34;demoMeshModel&#34;] retain];
    //[demoMeshModel ensureVertexContent];  // I see nothing if i uncomment this
    demoMeshModel.allocatedVertexCapacity = [arr_location2 count]*2;
    demoMeshModel.allocatedVertexIndexCapacity = [indices count]+[arr_location2 count]*6+1;
    demoMeshModel.drawingMode = GL_TRIANGLES;

    // set the vertex for the original flat shape
    for (int index = 0; index &#60; [arr_location2 count]; index++) {
        [demoMeshModel setVertexLocation:cc3v([[arr_location2 objectAtIndex:index] CGPointValue].x, [[arr_location2 objectAtIndex:index] CGPointValue].y, 0.0) at:index];
        //[demoMeshModel setVertexNormal:kCC3VectorUnitYPositive at:index];
    }

    // set the vertex for below
    for (int index = 0; index &#60; [arr_location2 count]; index++) {
        [demoMeshModel setVertexLocation:cc3v([[arr_location2 objectAtIndex:index] CGPointValue].x, [[arr_location2 objectAtIndex:index] CGPointValue].y, -10.0) at:([arr_location2 count]+index)];
        //[demoMeshModel setVertexNormal:kCC3VectorUnitZPositive at:index];
    }

    // set the indices
    for (int index = 0; index &#60; (sizeof(arr_indice)/sizeof(arr_indice[0])); index++) {
        [demoMeshModel setVertexIndex:arr_indice[index] at:index];
    }

    // 6 indices per side, H has 12 side
    int indexIndice = (sizeof(arr_indice)/sizeof(arr_indice[0]));

    for (int index = 0; index &#60; [arr_location2 count]; index++) {
        NSLog(@&#34;face:%i&#34;,index);
        // first triangle in the face
        indexIndice++;
        [demoMeshModel setVertexIndex:[arr_location2 count]+index at:indexIndice]; // 4
        NSLog(@&#34;set indice pos:%i at index:%i&#34;,([arr_location2 count]+index),indexIndice);

        indexIndice++;
        if (([arr_location2 count]+index+1) == ([arr_location2 count]*2)) {  // 5
            [demoMeshModel setVertexIndex:[arr_location2 count] at:indexIndice];
            NSLog(@&#34;set indice pos:%i at index:%i&#34;,[arr_location2 count],indexIndice);

        }else{
            [demoMeshModel setVertexIndex:[arr_location2 count]+index+1 at:indexIndice];
            NSLog(@&#34;set indice pos:%i at index:%i&#34;,([arr_location2 count]+index+1),indexIndice);
        }
        indexIndice++;
        [demoMeshModel setVertexIndex:index at:indexIndice]; // 0
        NSLog(@&#34;set indice pos:%i at index:%i&#34;,index,indexIndice);

        // second triangle in the face

        indexIndice++;
        if (([arr_location2 count]+index+1) == ([arr_location2 count]*2)) {  // 5
            [demoMeshModel setVertexIndex:[arr_location2 count] at:indexIndice];
            NSLog(@&#34;set indice pos:%i at index:%i&#34;,[arr_location2 count],indexIndice);

        }else{
            [demoMeshModel setVertexIndex:[arr_location2 count]+index+1 at:indexIndice];
            NSLog(@&#34;set indice pos:%i at index:%i&#34;,([arr_location2 count]+index+1),indexIndice);
    }

        indexIndice++;
        if ((index+1) == [arr_location2 count]) {
            [demoMeshModel setVertexIndex:0 at:indexIndice]; // 1
            NSLog(@&#34;set indice pos:%i at index:%i&#34;,0,indexIndice);

        }else{
            [demoMeshModel setVertexIndex:index+1 at:indexIndice]; // 1
            NSLog(@&#34;set indice pos:%i at index:%i&#34;,(index+1),indexIndice);

        }

        indexIndice++;
        [demoMeshModel setVertexIndex:index at:indexIndice]; // 0
        NSLog(@&#34;set indice pos:%i at index:%i&#34;,index,indexIndice);

    }

    CC3MeshNode* demoMesh = [CC3MeshNode nodeWithName:@&#34;demoMeshNode&#34;];
    demoMesh.mesh = demoMeshModel;
    demoMesh.material = [CC3Material shiny];
    demoMesh.material.diffuseColor = CCC4FMake(1.0, 1.0, 0.0,1.0);
    //demoMesh.color = ccRED;
    //[demoMesh createGLBuffers];
    [self addChild:demoMesh];
}</code></pre>
<p>I have noted that the start point change the display triangle or not even if i rotate the same way.<br />
For example:<br />
Setting the indices from 1,2,3 can display the triangle but 2,3,2 don't display it.<br />
It's the same clock turn, just starting from another point.</p>
<p>Can someone explain me ?
</p></description>
		</item>
		<item>
			<title>linked leo on "How to fill a shape with triangles programmatically ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/232506#post-389479</link>
			<pubDate>Sat, 23 Feb 2013 10:08:30 +0000</pubDate>
			<dc:creator>linked leo</dc:creator>
			<guid isPermaLink="false">389479@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks for your help, i was very close to the solution :)</p>
<p>Here is the working code:<br />
<pre><code>- (void)addBatimentH{
    static float arr_location[] = {0,0,0, 10,0,0, 10,20,0, 20,20,0, 20,0,0, 30,0,0, 30,50,0, 20,50,0, 20,30,0, 10,30,0, 10,50,0, 0,50,0, 0,0,0};

    NSMutableArray *arr_location2 = [[NSMutableArray alloc] init];

    // fill the NSMutableArray with the arr_location data
    for (int item = 0; item &#60; (sizeof(arr_location)/sizeof(arr_location[0])); item++) {
        [arr_location2 addObject:[NSValue valueWithCGPoint:CGPointMake(arr_location[item], arr_location[item+1])]];
        item++;
        item++;

    }

    // get the triangulation points
    NSArray *indices = [self triangulateVertices:arr_location2];
    NSLog(@&#34;indices:%@ count:%i&#34;,indices,[indices count]);

    // correct H except a missing part
    //static ushort arr_indice[] = {3,4,5,5,6,7,9,10,11,5,7,8,3,5,8,2,3,8,2,8,9,2,9,11,1,2,11};

     ushort arr_indice[[indices count]];

     for (int item = 0; item &#60; [indices count]; item++) {
     //NSLog(@&#34;fill indice item:%i&#34;,item);
         for (int loc = 0; loc &#60; [arr_location2 count]; loc++) {
             if (CGPointEqualToPoint([[arr_location2 objectAtIndex:loc] CGPointValue], [[indices objectAtIndex:item] CGPointValue])) {
                 NSLog(@&#34;add to indice[%i]:%i&#34;,item,loc);
                 arr_indice[item] = loc;
             }
         }
     }

    //NSLog(@&#34;size of NON static indice:%li&#34;, (sizeof(arr_indice)/sizeof(arr_indice[0])));

    CC3VertexArrayMesh *demoMeshModel = [[CC3VertexArrayMesh meshWithName:@&#34;demoMeshModel&#34;] retain];
    //[demoMeshModel ensureVertexContent];  // I see nothing if i uncomment this
    demoMeshModel.allocatedVertexCapacity = [arr_location2 count];
    demoMeshModel.allocatedVertexIndexCapacity = [indices count];
    //demoMeshModel.drawingMode = GL_LINE_STRIP;

    // set the vertex
    for (int index = 0; index &#60; [arr_location2 count]; index++) {
        [demoMeshModel setVertexLocation:cc3v([[arr_location2 objectAtIndex:index] CGPointValue].x, [[arr_location2 objectAtIndex:index] CGPointValue].y, 0.0) at:index];
    }

    // set the indices
    for (int index = 0; index &#60; (sizeof(arr_indice)/sizeof(arr_indice[0])); index++) {
        [demoMeshModel setVertexIndex:arr_indice[index] at:index];
    }

    CC3MeshNode* demoMesh = [CC3MeshNode nodeWithName:@&#34;demoMeshNode&#34;];
    demoMesh.mesh = demoMeshModel;
    demoMesh.material = [CC3Material shiny];
    demoMesh.material.diffuseColor = CCC4FMake(1.0, 1.0, 0.0,1.0);
    //demoMesh.color = ccRED;
    //[demoMesh createGLBuffers];
    [self addChild:demoMesh];
}</code></pre>
<p>Before this i have upgraded my Cocos2d from 1.0.1 to 1.1 RC0, maybe it has helped a little too.</p>
<p>I still have one problem about the triangulation process, a part is missing.<br />
I mean only one triangle is missing, call it the first or the last. It's the half bottom left part, the one with the 3 point 0,0,0 10,0,0 0,50,0</p>
<p>Any idea ?</p>
<p>Edit:<br />
I have found :)</p>
<p>I must not close the loop with arr_location, just remove the 3 last point: 0,0,0</p>
<p>The next step is to find a easy way to convert this flat H shape in 3D with a height, the triangulation process is for a 2D surface only.
</p></description>
		</item>
		<item>
			<title>Bill Hollings on "How to fill a shape with triangles programmatically ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/232506#post-389016</link>
			<pubDate>Sat, 23 Feb 2013 02:00:24 +0000</pubDate>
			<dc:creator>Bill Hollings</dc:creator>
			<guid isPermaLink="false">389016@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@linked leo</p>
<p>To allocate content for meshes automatically, it's best to use the <code>vertexContentTypes</code>, <code>allocatedVertexCapacity</code> and <code>allocatedVertexIndexCapacity</code> properties. These automatically set the types of vertex content for the mesh, allocate memory for the vertices, and handle cleaning up all the memory allocations after the mesh is no longer needed. It's much better than trying to allocate memory yourself, or trying to deal with static variables.</p>
<p>Once allocated, you can then use the <code>setVertex...</code> family of methods to populate each vertex with the content you want.</p>
<p>Read the API documentation on those properties and methods. And have a look at the implementations of the family of <code>populateAs...</code> methods in <code>CC3ParametricMeshes.m</code> to see how these are used to create the parametric meshes already available in <strong>cocos3d</strong>.</p>
<p>...Bill
</p></description>
		</item>
		<item>
			<title>linked leo on "How to fill a shape with triangles programmatically ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/232506#post-388849</link>
			<pubDate>Fri, 22 Feb 2013 22:58:01 +0000</pubDate>
			<dc:creator>linked leo</dc:creator>
			<guid isPermaLink="false">388849@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Now i can remove the static var for the location like the code below:</p>
<pre><code>//demoMeshModel.vertexLocations = locationDemo;

    [demoMeshModel setVertexLocation:cc3v(0.0, 0.0, 0.0) at:0];
    [demoMeshModel setVertexLocation:cc3v(10.0, 0.0, 0.0) at:1];
    [demoMeshModel setVertexLocation:cc3v(10.0, 20.0, 0.0) at:2];
    [demoMeshModel setVertexLocation:cc3v(20.0, 20.0, 0.0) at:3];
    [demoMeshModel setVertexLocation:cc3v(20.0, 0.0, 0.0) at:4];
    [demoMeshModel setVertexLocation:cc3v(30.0, 0.0, 0.0) at:5];
    [demoMeshModel setVertexLocation:cc3v(30.0, 50.0, 0.0) at:6];
    [demoMeshModel setVertexLocation:cc3v(20.0, 50.0, 0.0) at:7];
    [demoMeshModel setVertexLocation:cc3v(20.0, 30.0, 0.0) at:8];
    [demoMeshModel setVertexLocation:cc3v(10.0, 30.0, 0.0) at:9];
    [demoMeshModel setVertexLocation:cc3v(10.0, 50.0, 0.0) at:10];
    [demoMeshModel setVertexLocation:cc3v(0.0, 50.0, 0.0) at:11];
    [demoMeshModel setVertexLocation:cc3v(0.0, 0.0, 0.0) at:12];</code></pre>
<p>In a near future i can pack it in a for loop, it's a good news :)</p>
<p>But i haven't find something for the indices.<br />
It would be nice to have something like "setVertexIndice[x]=myIndiceValue"</p>
<p>I have found this in the CC3ParametricMeshes.m:<br />
<pre><code>GLushort* indices = self.vertexIndices.vertices;

// and below
indices[x]=myValue;</code></pre>
<p>But if i try:<br />
<pre><code>GLushort* indices = demoMeshModel.vertexIndices.vertices;</code></pre>
<p>I have a error "Cannot initialise a variable of type 'Glushort *' ....with a value 'Glvoid *'</p>
<p>I hope someone can help me.
</p></description>
		</item>
		<item>
			<title>linked leo on "How to fill a shape with triangles programmatically ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/232506#post-388509</link>
			<pubDate>Fri, 22 Feb 2013 16:55:10 +0000</pubDate>
			<dc:creator>linked leo</dc:creator>
			<guid isPermaLink="false">388509@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I finally get something, here is my code:</p>
<pre><code>- (void)addBatimentH{
    static float arr_location[] = {0,0,0, 10,0,0, 10,20,0, 20,20,0, 20,0,0, 30,0,0, 30,50,0, 20,50,0, 20,30,0, 10,30,0, 10,50,0, 0,50,0, 0,0,0};
    NSMutableArray *arr_location2 = [[NSMutableArray alloc] init];

    for (int item = 0; item &#60; 13*3; item++) {
        [arr_location2 addObject:[NSValue valueWithCGPoint:CGPointMake(arr_location[item], arr_location[item+1])]];
        item++;
        item++;

    }

    NSArray *indices = [self triangulateVertices:arr_location2];
    NSLog(@&#34;indices:%@&#34;,indices);

    int numberOfIndicesPoint = [indices count];
    NSLog(@&#34;numberOfIndicesPoint:%i&#34;,numberOfIndicesPoint);

    // correct H except a missing part
    //static ushort arr_indice[] = {3,4,5,5,6,7,9,10,11,5,7,8,3,5,8,2,3,8,2,8,9,2,9,11,1,2,11};

    ushort arr_indice_tmp[numberOfIndicesPoint];

    NSString *final = @&#34;&#34;;

    for (int item = 0; item &#60; [indices count]; item++) {
        //NSLog(@&#34;fill indice item:%i&#34;,item);
        for (int loc = 0; loc &#60; [arr_location2 count]; loc++) {
            if (CGPointEqualToPoint([[arr_location2 objectAtIndex:loc] CGPointValue], [[indices objectAtIndex:item] CGPointValue])) {
                [final stringByAppendingString:[NSString stringWithFormat:@&#34;%i&#34;, loc]];
                NSLog(@&#34;add to indice:%i&#34;,loc);
                arr_indice_tmp[item] = loc;
            }
        }

    }

    CC3VertexLocations *locationDemo;
    //CC3VertexNormals *demonormal;
    CC3VertexIndices *demoIndices;
    CC3VertexArrayMesh *demoMeshModel;

    locationDemo = [[CC3VertexLocations vertexArrayWithName:@&#34;demoLocation&#34;] retain];
    locationDemo.vertexCount = 13;
    locationDemo.vertices = arr_location;

    demoIndices = [CC3VertexIndices vertexArrayWithName: @&#34;demoIndicies&#34;];
    demoIndices.drawingMode = GL_TRIANGLES; 

    demoIndices.vertexCount =numberOfIndicesPoint;
    demoIndices.vertices = arr_indice_tmp;

    demoMeshModel = [[CC3VertexArrayMesh meshWithName:@&#34;demoMeshModel&#34;] retain];
    demoMeshModel.vertexLocations = locationDemo;
    demoMeshModel.vertexIndices = demoIndices;

    CC3MeshNode* demoMesh = [CC3MeshNode nodeWithName:@&#34;demoMeshNode&#34;];
    demoMesh.mesh = demoMeshModel;
    demoMesh.material = [CC3Material shiny];
    demoMesh.material.diffuseColor = CCC4FMake(1.0, 1.0, 0.0,1.0);
    //demoMesh.color = ccRED;
    [self addChild:demoMesh];
}

- (NSArray *) triangulateVertices:(NSMutableArray *)vertices {

    Vector2dVector *inputPointsForTriangulation = new Vector2dVector;
    for (NSValue *value in vertices) {
        CGPoint point = [value CGPointValue];
        NSLog(@&#34;point(x,y):%f;%f&#34;,point.x, point.y);
        inputPointsForTriangulation-&#62;push_back( Vector2d(point.x,point.y));
    }
    // Triangulate results
    Vector2dVector triangulatedPoints;

    Triangulate::Process(*inputPointsForTriangulation, triangulatedPoints);
    delete inputPointsForTriangulation;

    int triangulatedPointCount = (int)triangulatedPoints.size();
    NSMutableArray *triangulatedPointsArray = [NSMutableArray arrayWithCapacity:triangulatedPointCount];

    for (int i = 0; i &#60; triangulatedPointCount; i++) {

        NSLog(@&#34;%i triangulated:%f,%f&#34;,i,triangulatedPoints[i].GetX(),triangulatedPoints[i].GetY() );
        NSValue *triangulatedPointValue = [NSValue valueWithCGPoint:CGPointMake(triangulatedPoints[i].GetX(), triangulatedPoints[i].GetY())];
        [triangulatedPointsArray addObject:triangulatedPointValue];
    }
    return triangulatedPointsArray;
}</code></pre>
<p>I have two problems:</p>
<p>1. When i use the calculated  indices and write them into arr_indice (it's the commented part), it's working fine.<br />
When i remove the static before "static ushort arr_indice[] ", it's no more working.<br />
If i use the calculated indices with the NON static var named arr_indice_tmp, i see nothing too.</p>
<p>I suppose the var has to be static but my knowledge in C is very limited, i don't know how to fill this static array with the calculated one.</p>
<p>2. The triangulation calculate well, very well, but it's missing one triangle. It's the first or the last, i don't know. It's the one that pass on the x=0 y=0 z=0 value which is the first point in my "H" shape.</p>
<p>If someone want to test my code, just use a empty project and past the two methods and this is the camera setup:<br />
<pre><code>CC3Camera* cam = [CC3Camera nodeWithName: @&#34;Camera&#34;];
cam.location = cc3v( 0.0, 0.0, 100.0 );
cam.rotation = cc3v(0.0f,0.0f,0.0f);</code></pre></description>
		</item>
		<item>
			<title>linked leo on "How to fill a shape with triangles programmatically ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/232506#post-388217</link>
			<pubDate>Fri, 22 Feb 2013 13:28:25 +0000</pubDate>
			<dc:creator>linked leo</dc:creator>
			<guid isPermaLink="false">388217@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks, i don't have understand every lines for now but i think it's what i search.</p>
<p>The problem is that that's for cocos2d 2. With cocos3d i use the v1, i have to adapt it a little.<br />
I'm good for a couple of hour headache :)
</p></description>
		</item>
		<item>
			<title>abitofcode on "How to fill a shape with triangles programmatically ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/232506#post-388053</link>
			<pubDate>Fri, 22 Feb 2013 11:38:05 +0000</pubDate>
			<dc:creator>abitofcode</dc:creator>
			<guid isPermaLink="false">388053@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Have you seen PRKit?</p>
<p>There's an interesting thread on this subject here <a href="http://www.cocos2d-iphone.org/forum/topic/8142" rel="nofollow">http://www.cocos2d-iphone.org/forum/topic/8142</a></p>
<p>And a cocos2d friendly version was linked to in the thread.</p>
<p><a href="https://github.com/asinesio/cocos2d-PRKit" rel="nofollow">https://github.com/asinesio/cocos2d-PRKit</a>
</p></description>
		</item>
		<item>
			<title>linked leo on "How to fill a shape with triangles programmatically ?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/232506#post-387994</link>
			<pubDate>Fri, 22 Feb 2013 10:49:22 +0000</pubDate>
			<dc:creator>linked leo</dc:creator>
			<guid isPermaLink="false">387994@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi,</p>
<p>After a lot of search i was able to draw some shapes and fill them with triangles. But i have to know the shape and decide myself how to fill this shape.</p>
<p>Here is the code i use to draw a flat "H":<br />
<pre><code>static float arr_location[] = {0,0,0, 10,0,0, 10,20,0, 20,20,0, 20,0,0, 30,0,0, 30,50,0, 20,50,0, 20,30,0, 10,30,0, 10,50,0, 0,50,0, 0,0,0};
    static ushort arr_indice[] = {0,1,2,3,4,5,6,7,8,9,10,11,12};

    CC3VertexLocations *locationDemo;
    //CC3VertexNormals *demonormal;
    CC3VertexIndices *demoIndices;
    CC3VertexArrayMesh *demoMeshModel;

    locationDemo = [[CC3VertexLocations vertexArrayWithName:@&#34;demoLocation&#34;] retain];
    locationDemo.vertexCount = 13;
    locationDemo.vertices = arr_location;

    demoIndices = [CC3VertexIndices vertexArrayWithName: @&#34;demoIndicies&#34;];
   // demoIndices.drawingMode = GL_LINE_STRIP;
    demoIndices.drawingMode = GL_TRIANGLES; 

    demoIndices.vertexCount =13;
    demoIndices.vertices = arr_indice;

    demoMeshModel = [[CC3VertexArrayMesh meshWithName:@&#34;demoMeshModel&#34;] retain];
    demoMeshModel.vertexLocations = locationDemo;
    demoMeshModel.vertexIndices = demoIndices;

    CC3MeshNode* demoMesh = [CC3MeshNode nodeWithName:@&#34;demoMeshNode&#34;];
    demoMesh.mesh = demoMeshModel;
    demoMesh.material = [CC3Material shiny];
    demoMesh.material.diffuseColor = CCC4FMake(1.0, 1.0, 0.0,1.0);
    //demoMesh.color = ccRED;
    [self addChild:demoMesh];</code></pre>
<p>I understand arr_indice[] in my code should fill the "H" and i can set it manually. For the moment it's wrong, it will only draw 4 triangles. But this is not the main problem,  i want to automate this process.</p>
<p>It's because i have a lot of custom shape and can't fill them manually for each, this will take me toooo much time.</p>
<p>I have read something about tesselation but i'm not familiar with, is it the way to go ?</p>
<p>Thanks
</p></description>
		</item>
		<item>
			<title>Bill Hollings on "Cocos3d - Calling a function every frame and getting time that passed since last frame"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/94875#post-247940</link>
			<pubDate>Sun, 09 Dec 2012 22:19:10 +0000</pubDate>
			<dc:creator>Bill Hollings</dc:creator>
			<guid isPermaLink="false">247940@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/125524'>merry_christmas</a></p>
<p>You don't need to try to schedule individual <code>CC3Nodes</code>.</p>
<p>The <code>visitor</code> that is passed to each <code>CC3Node</code> in the <code>updateBeforeTransform:</code> method contains a <code>deltaTime</code> property.</p>
<p>I should think that's what you are looking for. It's the same value that appears to the <code>CC3Layer</code>'s <code>update:</code> method (which you can verify by following what happens in that <code>CC3Layer</code> method).</p>
<p>Have a look at the <code>SpinningNode</code> class in the <code>CC3DemoMashUp</code> demo app for an example of a node that uses the <code>visitor</code> <code>deltaTime</code> value to control its motion.</p>
<p>On a related note, the <code>addDieCube:</code> method of <code>CC3DemoMashUpScene</code> shows how to swap the class of a loaded POD node so that you can make use of specialized behaviour (in this case the node class is changed to <code>SpinningNode</code> to make use of that <code>deltaTime</code> behaviour.</p>
<p>In addition, for many motions, <code>CC3Nodes</code> <em>can</em> be controlled via <code>CCActions</code>, which provide a wealth of off-the-shelf behaviour. There are a number of examples of using <code>CCActions</code> in the <code>CC3DemoMashUp</code> as well.</p>
<p>...Bill
</p></description>
		</item>
		<item>
			<title>Birkemose on "Cocos3d - Calling a function every frame and getting time that passed since last frame"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/94875#post-246173</link>
			<pubDate>Sat, 08 Dec 2012 16:33:36 +0000</pubDate>
			<dc:creator>Birkemose</dc:creator>
			<guid isPermaLink="false">246173@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ups. I just checked, and you are of course right. I have no idea why schedule isnt available for a 3D node.
</p></description>
		</item>
		<item>
			<title>merry_christmas on "Cocos3d - Calling a function every frame and getting time that passed since last frame"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/94875#post-246068</link>
			<pubDate>Sat, 08 Dec 2012 14:31:19 +0000</pubDate>
			<dc:creator>merry_christmas</dc:creator>
			<guid isPermaLink="false">246068@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>For anyone with a similar problem here is what I found in another example -<br />
If you are trying to get the time that passed since last frame when using the updateBeforeTransform method here is how you can do it:</p>
<p>-(void) updateBeforeTransform: (CC3NodeUpdatingVisitor*) visitor<br />
{<br />
	// the time slice since last update<br />
	float deltaTime = visitor.deltaTime;</p>
<p>	[self updatePlayer:deltaTime];<br />
}</p>
<p>It's simple but I was stuck on this for a while ;)
</p></description>
		</item>
		<item>
			<title>merry_christmas on "Cocos3d - Calling a function every frame and getting time that passed since last frame"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/94875#post-245961</link>
			<pubDate>Sat, 08 Dec 2012 12:49:04 +0000</pubDate>
			<dc:creator>merry_christmas</dc:creator>
			<guid isPermaLink="false">245961@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I googled the warning message and it seems that you have to call '... schedule:' in Layer.m instead of the Scene.m file.<br />
However, this again leaves me wondering how to access the mesh that I created in Scene.m :(<br />
I guess I would have to use something like this:<br />
<code>CC3MeshNode* CubeTest = (CC3MeshNode*)[myWorld getNodeNamed: @"Cube"];</code><br />
instead of:<br />
<code>CC3MeshNode* CubeTest = (CC3MeshNode*)[self getNodeNamed: @"Cube"];</code></p>
<p>With myWorld being a reference to the Scene where I created the mesh..<br />
Not sure exactly how to pass the reference through, but I guess I'll have to try it out and see if I can find anything on the topic :)
</p></description>
		</item>
		<item>
			<title>merry_christmas on "Cocos3d - Calling a function every frame and getting time that passed since last frame"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/94875#post-245950</link>
			<pubDate>Sat, 08 Dec 2012 12:38:19 +0000</pubDate>
			<dc:creator>merry_christmas</dc:creator>
			<guid isPermaLink="false">245950@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks for your reply, that's really helpful! However when trying to implement this I get a warning which won't let me build the game.<br />
I have now done the following:<br />
• I added these lines of code to the initializeScene method of the Scene.m file:</p>
<p><code>CC3MeshNode* CubeTest = (CC3MeshNode*)[self getNodeNamed: @"Cube"];<br />
[CubeTest schedule:@selector( myUpdateMethod: )];</code></p>
<p>• I then added the update method to the same Scene.m file:</p>
<p><code>-(void)myUpdateMethod:(ccTime)dt {<br />
    NSLog(@"This is called every frame!!");<br />
}</code></p>
<p>The warning I get is "'CC3MeshNode' may not respond to 'schedule:'"<br />
Do you know what might be causing this warning (is there a file I must import to use the schedule method)?<br />
Thanks for your time
</p></description>
		</item>
		<item>
			<title>Birkemose on "Cocos3d - Calling a function every frame and getting time that passed since last frame"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/94875#post-245934</link>
			<pubDate>Sat, 08 Dec 2012 12:18:55 +0000</pubDate>
			<dc:creator>Birkemose</dc:creator>
			<guid isPermaLink="false">245934@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>For any CCNode or its descendant, you can schedule an update.<br />
<pre><code>[ myNode schedule:@selector( myUpdateMethod: ) ];

-( void )myUpdateMethod:( ccTime )dt {

}</code></pre></description>
		</item>
		<item>
			<title>merry_christmas on "Cocos3d - Calling a function every frame and getting time that passed since last frame"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/94875#post-245925</link>
			<pubDate>Sat, 08 Dec 2012 11:59:40 +0000</pubDate>
			<dc:creator>merry_christmas</dc:creator>
			<guid isPermaLink="false">245925@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have tried adding an update function to the Layer.m file like this:</p>
<p>-(void) update: (ccTime) dt {</p>
<p>    NSLog(@"This is called every frame!");<br />
}</p>
<p>This will work nicely and I get the message repeatedly in the NSLog, however this is what I still am having trouble with:<br />
I am creating the Node from a .pod file in the initializeScene method of the Scene.m file and get the node using:<br />
CC3Node * cube = [self getNodeNamed:@"Cube"];</p>
<p>I have the "cube" variable in the Scene.m file and the update method in the Layer.m file...<br />
How can I access the cube mesh node (eg to set it's location) from within the update method of the Layer.m file?</p>
<p>Again any help would be greatly appreciated!
</p></description>
		</item>
		<item>
			<title>merry_christmas on "Cocos3d - Calling a function every frame and getting time that passed since last frame"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/94875#post-243261</link>
			<pubDate>Thu, 06 Dec 2012 18:05:04 +0000</pubDate>
			<dc:creator>merry_christmas</dc:creator>
			<guid isPermaLink="false">243261@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hey guys, I started using cocos3d a couple of days ago and am really enjoying using it.<br />
I am still quite new to working in xCode in general and have been following a tutorial for cocos2d.<br />
The problem I have run into is simply calling a function every frame and being able to get the time that passed since last frame (for frame-rate independance)..<br />
I looked into some of the cocos3d documentation and found the updateBeforeTransform function which is called before the objects in the scene are rendered:</p>
<p>-(void) updateBeforeTransform: (CC3NodeUpdatingVisitor*) visitor {<br />
    cam.location = cc3v(cam.location.x, cam.location.y, cam.location.z-0.02);<br />
}</p>
<p>This works and will move the camera forwards, however I would like to be able to multiply the value it moves each frame by time that has passed to avoid there being a difference in how fast the camera moves when the frame-rate varies. Something like:</p>
<p>cam.location = cc3v(cam.location.x, cam.location.y, cam.location.z - (200 * dt));</p>
<p>Is there a way to call a custom function each frame or use the updateBeforeTransform function to do this?<br />
Thank you in advance for the help, really appreciated :)
</p></description>
		</item>
		<item>
			<title>freelogin on "TDAnimEngine: Maya to Cocos2D"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18186/page/2#post-191807</link>
			<pubDate>Tue, 09 Oct 2012 22:56:32 +0000</pubDate>
			<dc:creator>freelogin</dc:creator>
			<guid isPermaLink="false">191807@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>No Help :(<br />
Wonderful
</p></description>
		</item>
		<item>
			<title>Aaqib20 on "3D - Collision Detection - Mesh?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/45610#post-190655</link>
			<pubDate>Fri, 05 Oct 2012 15:36:34 +0000</pubDate>
			<dc:creator>Aaqib20</dc:creator>
			<guid isPermaLink="false">190655@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/49889'>Bill</a>, Wow, thanks alot. Now. I'm able to detect collisions against meshes!.</p>
<p>Thanks<br />
Aaqib
</p></description>
		</item>
		<item>
			<title>Bill Hollings on "3D - Collision Detection - Mesh?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/45610#post-190296</link>
			<pubDate>Fri, 05 Oct 2012 02:18:32 +0000</pubDate>
			<dc:creator>Bill Hollings</dc:creator>
			<guid isPermaLink="false">190296@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/102768'>Aaqib20</a></p>
<p>The <code>transformMatrix</code> property of each node contains the matrix that transforms local coordinates to global. For each node, that matrix consolidates all of the transforms of the ancestor (parent) nodes, in a hierarchical structure.</p>
<p> The <code>transformMatrix</code> is automatically calculated on each update cycle in between the <code>updateBeforeTransform:</code> and <code>updateAfterTransform:</code> callback methods. Typically, you set your transform properties (<code>location</code>, <code>rotation</code> and <code>scale</code>), in the <code>updateBeforeTransform:</code> method. By the time the <code>updateAfterTransform:</code> callback is invoked, the <code>transformMatrix</code> is up to date.</p>
<p> The <code>transformMatrixInverted</code> property contains the complimentary matrix that converts global coordinates to local coordinates.</p>
<p>There are already several <code>global...</code> properties on each node that describe the global orientation of the node (eg- <code>globalLocation</code>). In addition, the collisions handled by the <code>doesIntersectNode:</code> method identified above automatically handle the conversion to global coordinates.</p>
<p>...Bill
</p></description>
		</item>
		<item>
			<title>Aaqib20 on "3D - Collision Detection - Mesh?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/45610#post-189583</link>
			<pubDate>Wed, 03 Oct 2012 18:36:27 +0000</pubDate>
			<dc:creator>Aaqib20</dc:creator>
			<guid isPermaLink="false">189583@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Also, how would you transform the local coordinate system of the mesh into global coordinates?<br />
 Because that would solve my problem in this case, as I can use the collision system against specific 'meshes'. </p>
<p>Thanks again<br />
Aaqib
</p></description>
		</item>
		<item>
			<title>Aaqib20 on "3D - Collision Detection - Mesh?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/45610#post-189471</link>
			<pubDate>Wed, 03 Oct 2012 14:26:41 +0000</pubDate>
			<dc:creator>Aaqib20</dc:creator>
			<guid isPermaLink="false">189471@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks for your reply, but Im unable to get it show for a CC3Node? (CC3PODNode)? However, I am able to get the boundingVolume to show for a CC3MeshNode... </p>
<p>For example,<br />
CC3Node* meshNode = [ballb getNodeNamed: @"spheres"]; //It works for 'CC3MeshNode' but not for CC3Node<br />
CCArray* arrayC = ((CC3NodeTighteningBoundingVolumeSequence*)meshNode.boundingVolume).boundingVolumes;<br />
CC3NodeSphericalBoundingVolume* sphericalBV = [arrayC objectAtIndex:3];<br />
sphericalBV.radius =10.0;<br />
sphericalBV.shouldDraw = YES; //doesn't draw the bounding volume for CC3Node but it does for CC3MeshNode</p>
<p>Could you please help me on this situation? Thanks again for your excellent help and work.<br />
Aaqib
</p></description>
		</item>
		<item>
			<title>Bill Hollings on "3D - Collision Detection - Mesh?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/45610#post-189098</link>
			<pubDate>Wed, 03 Oct 2012 02:14:55 +0000</pubDate>
			<dc:creator>Bill Hollings</dc:creator>
			<guid isPermaLink="false">189098@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/102768'>Aaqib20</a></p>
<p>Basic collision detection between two nodes based on their bounding volumes is supported.</p>
<p>The <code>CC3Node</code> method <code>doesIntersectNode</code> is the simplest way to use this feature. Have a look at the <code>checkForCollisions</code> method of <code>CC3DemoMashUpScene</code> for an example of using this technique.</p>
<p>Currently, you can create spherical and bounding-box shaped bounding volumes on a node. A mesh bounding volume should be available at some point in the future.</p>
<p>...Bill
</p></description>
		</item>
		<item>
			<title>Aaqib20 on "3D - Collision Detection - Mesh?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/45610#post-188868</link>
			<pubDate>Tue, 02 Oct 2012 21:01:34 +0000</pubDate>
			<dc:creator>Aaqib20</dc:creator>
			<guid isPermaLink="false">188868@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Edit: The link is working.</p>
<p>But can anyone help me with a collision detection between nodes?<br />
Thanks<br />
Aaqib
</p></description>
		</item>
		<item>
			<title>Aaqib20 on "3D - Collision Detection - Mesh?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/45610#post-188607</link>
			<pubDate>Mon, 01 Oct 2012 23:24:21 +0000</pubDate>
			<dc:creator>Aaqib20</dc:creator>
			<guid isPermaLink="false">188607@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Also.... Can anyone do me a favour.. Can you upload the 'colloda2pod' software for me or send it via email? Because the link doesn't work anymore and I have forgotton to backup this software so Im in need of it?<br />
Thanks again<br />
Aaqib
</p></description>
		</item>
		<item>
			<title>Aaqib20 on "3D - Collision Detection - Mesh?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/45610#post-188605</link>
			<pubDate>Mon, 01 Oct 2012 23:13:20 +0000</pubDate>
			<dc:creator>Aaqib20</dc:creator>
			<guid isPermaLink="false">188605@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi, im trying to figure out how to detect a collision system between a 'sphere' and a mesh? As the 'mesh' gives it own coordinate system, im not able to use the global coordinate for it, so it won't intersect the sphere. Im able to intersect  between a node and a 'sphere' but not a 'mesh' and a 'sphere' because the mesh has its 'own' coordinate system which is different to the spheres?</p>
<p>Does anyone know I can translate the mesh coordinate system into the 'node's' coordinate system so Im able to 'detect' collision between them? Really stuck on this and would be cool if anyone can help?</p>
<p>Thanks a lot<br />
Aaqib
</p></description>
		</item>
		<item>
			<title>freelogin on "TDAnimEngine: Maya to Cocos2D"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18186/page/2#post-188561</link>
			<pubDate>Mon, 01 Oct 2012 19:35:06 +0000</pubDate>
			<dc:creator>freelogin</dc:creator>
			<guid isPermaLink="false">188561@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have the same problem: (</p>
<p><a href="http://www.image-share.com/ipng-1760-242.html" rel="nofollow">http://www.image-share.com/ipng-1760-242.html</a></p>
<p>I tried: cocos2d-iphone-2.1-beta2, cocos2d-iphone-1.0.1, Kobold2D_v2.0.4<br />
Please lay out a working version for cocos2d 2.0.<br />
Together with all libraries.
</p></description>
		</item>
		<item>
			<title>dyego_s on "TDAnimEngine: Maya to Cocos2D"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18186/page/2#post-186650</link>
			<pubDate>Thu, 27 Sep 2012 14:48:28 +0000</pubDate>
			<dc:creator>dyego_s</dc:creator>
			<guid isPermaLink="false">186650@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I tried to use FlashToCocos2D that required TBXML Library to work. I put them all together and run with the robot sprites exemple from FlashToCocos2D and when I build the robot stay like the picture in the link bellow and nothing happens.</p>
<p><a href="http://www.image-share.com/ipng-1760-242.html" rel="nofollow">http://www.image-share.com/ipng-1760-242.html</a></p>
<p>has someone the same problem?
</p></description>
		</item>
		<item>
			<title>Alexander_Hartdegen on "TDAnimEngine: Maya to Cocos2D"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/18186/page/2#post-181730</link>
			<pubDate>Mon, 17 Sep 2012 03:44:17 +0000</pubDate>
			<dc:creator>Alexander_Hartdegen</dc:creator>
			<guid isPermaLink="false">181730@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Neat~ thanks
</p></description>
		</item>

	</channel>
</rss>
