How to get Normals and UV coordinates ;)

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/02/2008 at 06:17, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   10.111 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
Hello 😉
I'm working on export filter. And I've problem.
I cam extract points and references to them.
T know, how to acces to phong array and uv array, but I don't know, how to connect right points with right UV coordinates and normals.
If I use function from UVWTag Get( poly_index ), that I get UVWStruct with four values. I make some attempts, but it don't work...
I have allocated array of phongs and UVs, but, how I can connect it with points?
If I get GetPolygons array, max value of each point reference is GetPointCount ? So, I can't use GetPolygons to refer into arrays of nomrals and UVs, is that thought correct :)...?
Thanks...

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/02/2008 at 06:47, xxxxxxxx wrote:

The UVWtag provides an UVWStruct for every polygon.

UVWStruct Get(LONG i) //i is the polygon index

The UVWStruct contains four vectors a,b,c,d. One for each point of the polygon. To make a connection between points and UVWs you simply read out the CPolygon structure of the polygon. It contains the indices to the four points of a polygon. So the vector a of the UVWStruct is connected to the point index a in the CPolyogn structure. It works the same for the normals. CreatePhongNormals() returns an array of vectors. It has the size of 4*GetPolygonCount(), (four normals for each polygon, so one for each point of an polygon). Things to remember, triangles have identical 3rd and 4th point indices, UVWs and normals. CreatePhongNormals() needs a phong tag to work otherwise it will crash.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/02/2008 at 06:58, xxxxxxxx wrote:

So - its only symbolic code 🙂

> \> for(int i = 0; i < GetPolygoncount; i++) \> { \>    vert[face[i].a];face[i].a;uvwstrct[i].a; normal[i\*4+0]; \>    vert[face[i].b];face[i].b;uvwstrct[i].b; normal[i\*4+1]; \>    vert[face[i].c];face[i].c;uvwstrct[i].c; normal[i\*4+2]; \> } \>

Is this right connection between all structures to make triangle?

Thanks for your advices ;)...

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/02/2008 at 07:07, xxxxxxxx wrote:

That looks ok. Just remember a quadrangle contains two triangles. So you should check if the polygon is a quadrangle or triangle. Do you want to export triangles only?

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/02/2008 at 08:17, xxxxxxxx wrote:

yes. This plugin is omly for me - and i triangulate everything before 🙂 export. But I know, how to do it, if I want to covnert qadtrangles to trianlges :).

I GOT IT !!!!! IT WORKS... JABABDADADAADDBABABADOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

I'm sorry :-[...
but... I'm very happy person :). Thank so much to your advices and support !!! Whaooo... and WHEPEEE... :)...