本文整理汇总了C#中Engine3D.Object3d.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Object3d.Update方法的具体用法?C# Object3d.Update怎么用?C# Object3d.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine3D.Object3d
的用法示例。
在下文中一共展示了Object3d.Update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Sphere
public static Object3d Sphere(float radius, int rings, int sectors)
{
try
{
Object3d sp = new Object3d();
sp.Name = "Sphere";
float R = 1f/(float)(rings-1);
float S = 1f/(float)(sectors-1);
float M_PI = (float)Math.PI;// *0.0174532925f; // with deg2rad
float M_PI_2 = M_PI / 2;
for(int r = 0; r < rings; r++)
{
for(int s = 0; s < sectors; s++)
{
float y =(float) Math.Sin( - M_PI_2 + M_PI * r * R );
float x = (float)Math.Cos(2 * M_PI * s * S) * (float)Math.Sin(M_PI * r * R);
float z = (float)Math.Sin(2 * M_PI * s * S) * (float)Math.Sin(M_PI * r * R);
Point3d pnt = new Point3d(x * radius, y * radius, z * radius);
sp.m_lstpoints.Add(pnt);
}
}
//indices.resize(rings * sectors * 4);
//std::vector<GLushort>::iterator i = indices.begin();
for(int r = 0; r < rings - 1; r++)
{
for (int s = 0; s < sectors - 1; s++)
{
Polygon p1 = new Polygon();
Polygon p2 = new Polygon();
sp.m_lstpolys.Add(p1);
sp.m_lstpolys.Add(p2);
p1.m_points = new Point3d[3];
p2.m_points = new Point3d[3];
p1.m_points[2] = sp.m_lstpoints[r * sectors + s];
p1.m_points[1] = sp.m_lstpoints[r * sectors + (s + 1)];
p1.m_points[0] = sp.m_lstpoints[(r + 1) * sectors + (s + 1)];
p2.m_points[2] = sp.m_lstpoints[(r + 1) * sectors + (s + 1)];
p2.m_points[1] = sp.m_lstpoints[(r + 1) * sectors + s];
p2.m_points[0] = sp.m_lstpoints[r * sectors + s];
}
}
sp.Update();
sp.Rotate(90 * 0.0174532925f, 0, 0);
sp.Update();
return sp;
}
catch(Exception ex)
{
DebugLogger.Instance().LogError(ex);
return null;
}
}
示例2: CreateGroundPlane
private static void CreateGroundPlane()
{
m_gp = new Object3d();
m_gp.Name = "GroundPlane";
Point3d p0=new Point3d(-500,-500,0);
Point3d p1=new Point3d(500,-500,0);
Point3d p2=new Point3d(500,500,0);
Point3d p3=new Point3d(-500,500,0);
m_gp.m_lstpoints.Add(p0);
m_gp.m_lstpoints.Add(p1);
m_gp.m_lstpoints.Add(p2);
m_gp.m_lstpoints.Add(p3);
Polygon ply0 = new Polygon();
ply0.m_points = new Point3d[3];
ply0.m_points[0] = p0;
ply0.m_points[1] = p1;
ply0.m_points[2] = p2;
Polygon ply1 = new Polygon();
ply1.m_points = new Point3d[3];
ply1.m_points[0] = p0;
ply1.m_points[1] = p2;
ply1.m_points[2] = p3;
m_gp.m_lstpolys.Add(ply0);
m_gp.m_lstpolys.Add(ply1);
m_gp.tag = Object3d.OBJ_GROUND; // groundplane tag
m_gp.Update();
// p1.m
}
示例3: ConvertFrom
private Object3d ConvertFrom(List<csgjs_polygon> lstply)
{
Object3d obj = new Object3d();
for (int i = 0; i < lstply.Count; i++)
{
csgjs_polygon poly = lstply[i];
for (int j = 2; j < poly.vertices.Count; j++)
{
Polygon ply = new Polygon(); // create a new polygon
ply.m_points = new Point3d[3];
obj.m_lstpolys.Add(ply); //add it to the list
Point3d p0 = new Point3d();
Point3d p1 = new Point3d();
Point3d p2 = new Point3d();
p0.Set(poly.vertices[0].pos.x, poly.vertices[0].pos.y, poly.vertices[0].pos.z);
p1.Set(poly.vertices[j - 1].pos.x, poly.vertices[j - 1].pos.y, poly.vertices[j - 1].pos.z);
p2.Set(poly.vertices[j].pos.x, poly.vertices[j].pos.y, poly.vertices[j].pos.z);
ply.m_points[0] = p0;
ply.m_points[1] = p1;
ply.m_points[2] = p2;
obj.m_lstpoints.Add(p0);
obj.m_lstpoints.Add(p1);
obj.m_lstpoints.Add(p2);
}
}
obj.Update();
return obj;
}
示例4: ProcessObjectChunk
Object3d ProcessObjectChunk(ThreeDSChunk chunk, Object3d e)
{
while (chunk.BytesRead < chunk.Length)
{
ThreeDSChunk child = new ThreeDSChunk(reader);
switch ((Groups)child.ID)
{
case Groups.C_OBJECT_MESH:
ProcessObjectChunk(child, e);
break;
case Groups.C_OBJECT_VERTICES:
//e.vertices = ReadVertices(child);
e.m_lstpoints = ReadVertices(child);
break;
case Groups.C_OBJECT_FACES:
//e.indices =
Triangle []tris = ReadIndices(child);
foreach (Triangle t in tris)
{
Polygon p = new Polygon();
p.m_points = new Point3d[3];
p.m_points[0] = (Point3d)e.m_lstpoints[t.vertex1];
p.m_points[1] = (Point3d)e.m_lstpoints[t.vertex2];
p.m_points[2] = (Point3d)e.m_lstpoints[t.vertex3];
e.m_lstpolys.Add(p);
}
e.Update();
if (child.BytesRead < child.Length)
ProcessObjectChunk(child, e);
break;
case Groups.C_OBJECT_MATERIAL:
string name2 = ProcessString(child);
Console.WriteLine(" Uses Material: {0}", name2);
Material mat;
if (materials.TryGetValue(name2, out mat))
e.material = mat;
else
Console.WriteLine(" Warning: Material '{0}' not found. ", name2);
SkipChunk(child);
break;
case Groups.C_OBJECT_UV:
int cnt = reader.ReadUInt16();
child.BytesRead += 2;
Console.WriteLine(" TexCoords: {0}", cnt);
//e.texcoords = new TexCoord[cnt];
//TexCoord tc = new TexCoord();
for (int ii = 0; ii < cnt; ii++)
{
//should add this to a list somewhere
TexCoord tc = new TexCoord(reader.ReadSingle(), reader.ReadSingle());
}
child.BytesRead += (cnt * (4 * 2));
break;
default:
SkipChunk(child);
break;
}
chunk.BytesRead += child.BytesRead;
//Console.WriteLine ( " ID: {0} Length: {1} Read: {2}", chunk.ID.ToString("x"), chunk.Length , chunk.BytesRead );
}
return e;
}
示例5: Clone
public virtual Object3d Clone()
{
Object3d obj = new Object3d();
try
{
obj.m_name = UVDLPApp.Instance().Engine3D.GetUniqueName( this.m_name); // need to find unique name
obj.m_fullname = this.m_fullname;
obj.tag = this.tag;
foreach (Polygon ply in m_lstpolys)
{
Polygon pl2 = new Polygon();
pl2.m_color = ply.m_color;
pl2.m_points = new Point3d[3];
obj.m_lstpolys.Add(pl2);
pl2.m_points[0] = new Point3d(ply.m_points[0]);
pl2.m_points[1] = new Point3d(ply.m_points[1]);
pl2.m_points[2] = new Point3d(ply.m_points[2]);
}
foreach (Polygon ply in obj.m_lstpolys)
{
foreach (Point3d pnt in ply.m_points)
{
obj.m_lstpoints.Add(pnt); // a fair bit of overlap, but whatever...
}
}
obj.Update();
}
catch (Exception ex)
{
DebugLogger.Instance().LogError(ex);
}
return obj;
}
示例6: ParseObject
void ParseObject(XmlNode xObject)
{
m_curObject = new Object3d();
m_smoothObj = false;
m_smoothLevel = -1;
ParseMesh(xObject["mesh"]);
m_curObject.m_fullname = m_filepath;
m_curObject.Name = Path.GetFileName(m_filepath);
m_curObject.Update();
//m_curObject.m_wireframe = 4;
m_objList.Add(m_curObject);
m_nobjects++;
}