protected override void RenderContent(GraphicsInterface gi) { int p1, p2, p3; for (int i = 0; i < triangles.Length; i++) { p1 = triangles[i].p1; p2 = triangles[i].p2; p3 = triangles[i].p3; gi.Color(1, 1, 1, 0.95f); gi.Drawing.Triangles.Begin(); gi.Normal(normals[p1]); gi.TexCoord(uvMap[p1, 0], uvMap[p1, 1]); gi.Vertex(positions[p1]); gi.Normal(normals[p2]); gi.TexCoord(uvMap[p2, 0], uvMap[p2, 1]); gi.Vertex(positions[p2]); gi.Normal(normals[p3]); gi.TexCoord(uvMap[p3, 0], uvMap[p3, 1]); gi.Vertex(positions[p3]); gi.Drawing.Triangles.End(); } }
protected override void RenderContent(GraphicsInterface gi) { gi.Normal(0, 0, 1); gi.Begin(BeginMode.Lines); gi.Vertex(fxbase, fybase - 5, fzbase); gi.Vertex(fxbase, fybase + fHeight * fSize + 0.5f, fzbase); gi.End(); }
protected override void RenderContent(GraphicsInterface gi) { int i, j; float theta, phi, theta1; float cosTheta, sinTheta; float cosTheta1, sinTheta1; float ringDelta, sideDelta; ringDelta = (float)(2.0f * Math.PI / fRings); sideDelta = (float)(2.0f * Math.PI / fSides); theta = 0.0f; cosTheta = 1.0f; sinTheta = 0.0f; for (i = fRings - 1; i >= 0; i--) { theta1 = theta + ringDelta; cosTheta1 = (float)Math.Cos(theta1); sinTheta1 = (float)Math.Sin(theta1); gi.Drawing.QuadStrip.Begin(); phi = 0.0f; for (j = fSides; j >= 0; j--) { float cosPhi, sinPhi, dist; phi += sideDelta; cosPhi = (float)Math.Cos(phi); sinPhi = (float)Math.Sin(phi); dist = fOuterRadius + fInnerRadius * cosPhi; gi.Normal(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi); gi.Vertex(cosTheta1 * dist, -sinTheta1 * dist, fInnerRadius * sinPhi); gi.Normal(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi); gi.Vertex(cosTheta * dist, -sinTheta * dist, fInnerRadius * sinPhi); } gi.Drawing.QuadStrip.End(); theta = theta1; cosTheta = cosTheta1; sinTheta = sinTheta1; } }
protected override void RenderContent(GraphicsInterface gi) { int i; for (i = 5; i >= 0; i--) { if (fStyle == CubeStyle.Solid) gi.Drawing.Quads.Begin(); else gi.Drawing.LineLoop.Begin(); gi.Normal(n[i]); //gl.glNormal3fv(n[i]); gi.Vertex3(v[faces[i][0]]); gi.Vertex3(v[faces[i][1]]); gi.Vertex3(v[faces[i][2]]); gi.Vertex3(v[faces[i][3]]); if (fStyle == CubeStyle.Solid) gi.Drawing.Quads.End(); else gi.Drawing.LineLoop.End(); } }
void RenderInsideRadiusCylinder(GraphicsInterface gi) { float angle; // draw inside radius cylinder for (int i = 0; i <= fTeeth; i++) { angle = i * 2.0f * (float)Math.PI / fTeeth; gi.Drawing.Lines.Begin(); gi.Normal(-(float)Math.Cos(angle), -(float)Math.Sin(angle), 0.0f); gi.Vertex(r0 * (float)Math.Cos(angle), r0 * (float)Math.Sin(angle), -fWidth * 0.5f); gi.Vertex(r0 * (float)Math.Cos(angle), r0 * (float)Math.Sin(angle), fWidth * 0.5f); gi.Vertex(r0 * (float)Math.Cos(angle), r0 * (float)Math.Sin(angle), -fWidth * 0.5f); gi.Vertex(r0 * (float)Math.Cos(angle + 4 * da), r0 * (float)Math.Sin(angle + 4 * da), -fWidth * 0.5f); gi.Vertex(r0 * (float)Math.Cos(angle), r0 * (float)Math.Sin(angle), fWidth * 0.5f); gi.Vertex(r0 * (float)Math.Cos(angle + 4 * da), r0 * (float)Math.Sin(angle + 4 * da), fWidth * 0.5f); gi.Drawing.Lines.End(); } }