public void SetUV(int tindex, int index, UVWStruct uv) { C4dApiPINVOKE.CAMorphNode_SetUV(swigCPtr, tindex, index, UVWStruct.getCPtr(uv)); if (C4dApiPINVOKE.SWIGPendingException.Pending) { throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); } }
public static void Get(SWIGTYPE_p_ConstUVWHandle dataptr, int i, UVWStruct res) { C4dApiPINVOKE.UVWTag_Get(SWIGTYPE_p_ConstUVWHandle.getCPtr(dataptr), i, UVWStruct.getCPtr(res)); if (C4dApiPINVOKE.SWIGPendingException.Pending) { throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetSlow(int i, UVWStruct s) { C4dApiPINVOKE.UVWTag_SetSlow(swigCPtr, i, UVWStruct.getCPtr(s)); if (C4dApiPINVOKE.SWIGPendingException.Pending) { throw C4dApiPINVOKE.SWIGPendingException.Retrieve(); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(UVWStruct obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
private static MeshComponent GetMesh(PolygonObject polyOb, float3[] normalsOb, UVWTag uvwTag, IEnumerable <int> range) { List <float3> normals = new List <float3>(); ushort nNewVerts = 0; VertexList verts = new VertexList(); List <float2> uvs = new List <float2>(); List <ushort> tris = new List <ushort>(); foreach (int i in range) { int iNorm = i * 4; double3 a, b, c, d; using (CPolygon poly = polyOb.GetPolygonAt(i)) { a = polyOb.GetPointAt(poly.a); b = polyOb.GetPointAt(poly.b); c = polyOb.GetPointAt(poly.c); d = polyOb.GetPointAt(poly.d); } float2 uvA = new float2(0, 0); float2 uvB = new float2(0, 1); float2 uvC = new float2(1, 1); float2 uvD = new float2(1, 0); if (uvwTag != null) { using (UVWStruct uvw = uvwTag.GetSlow(i)) { uvA = new float2((float)uvw.a.x, 1.0f - (float)uvw.a.y); uvB = new float2((float)uvw.b.x, 1.0f - (float)uvw.b.y); uvC = new float2((float)uvw.c.x, 1.0f - (float)uvw.c.y); uvD = new float2((float)uvw.d.x, 1.0f - (float)uvw.d.y); } } verts.Add((float3)a); verts.Add((float3)b); verts.Add((float3)c); uvs.Add(uvA); uvs.Add(uvB); uvs.Add(uvC); float3 faceNormal = CalcFaceNormal((float3)a, (float3)b, (float3)c); float3 normalD; if (normalsOb != null) { normals.Add(AdjustNormal(normalsOb[iNorm++], faceNormal)); normals.Add(AdjustNormal(normalsOb[iNorm++], faceNormal)); normals.Add(AdjustNormal(normalsOb[iNorm++], faceNormal)); normalD = AdjustNormal(normalsOb[iNorm++], faceNormal); } else { normals.Add(faceNormal); normals.Add(faceNormal); normals.Add(faceNormal); normalD = faceNormal; } tris.AddRange(new ushort[] { nNewVerts, (ushort)(nNewVerts + 2), (ushort)(nNewVerts + 1) }); if (c != d) { // The Polyogon is not a triangle, but a quad. Add the second triangle. verts.Add((float3)d); uvs.Add(uvD); normals.Add(normalD); tris.AddRange(new ushort[] { nNewVerts, (ushort)(nNewVerts + 3), (ushort)(nNewVerts + 2) }); nNewVerts += 1; } nNewVerts += 3; } Debug.WriteLine(verts.Count); return(new MeshComponent() { Normals = normals.ToArray(), Vertices = verts.ToArray(), Triangles = tris.ToArray(), UVs = uvs.ToArray(), BoundingBox = new AABBf(verts.Min, verts.Max) }); }
public UVWStruct GetSlow(int i) { UVWStruct ret = new UVWStruct(C4dApiPINVOKE.UVWTag_GetSlow(swigCPtr, i), true); return(ret); }