Example #1
0
 public ILVertexRenderer CreateVertexRenderer(Type vertexType, ILShape shape)
 {
     if (vertexType == typeof(C4bV3f))
     {
         ILVertexRenderer ret;
         if (shape is ILQuads)
         {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Quads);
         }
         else if (shape is ILPolygon)
         {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Polygon);
         }
         else if (shape is ILLine)
         {
             ret            = new ILOGLLineRendererC4bV3f(shape.VertexCount);
             ret.CloseLines = false;
         }
         else if (shape is ILTriangle)
         {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Triangles);
         }
         else if (shape is ILQuad)
         {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Quads);
         }
         else if (shape is ILLines)
         {
             ret = new ILOGLLinesRendererC4bV3f();
         }
         else if (shape is ILTriangles)
         {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Triangles);
         }
         else if (shape is ILPoints)
         {
             ret = new ILOGLPointsRendererC4bV3f();
         }
         else
         {
             throw new NotSupportedException("Shape of type " + shape.GetType().Name + " is not supported!");
         }
         return(ret);
     }
     else if (vertexType == typeof(C4fN3fV3f))
     {
         ILOGLVertexRendererC4fN3fV3f ret;
         if (shape is ILLitQuads)
         {
             ret          = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Quads);
             ret.UseLight = true;
         }
         else if (shape is ILLitPolygon)
         {
             ret          = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Polygon);
             ret.UseLight = true;
         }
         else if (shape is ILLitQuad)
         {
             ret          = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Quads);
             ret.UseLight = true;
         }
         else if (shape is ILLitTriangle)
         {
             ret          = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Triangles);
             ret.UseLight = true;
         }
         else if (shape is ILLitSphere)
         {
             ret          = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Triangles);
             ret.UseLight = true;
         }
         else if (shape is ILLitTriangles)
         {
             ret          = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Triangles);
             ret.UseLight = true;
         }
         else
         {
             throw new NotSupportedException("Shape of type " + shape.GetType().Name + " is not supported for vertex type " + vertexType.Name + "!");
         }
         return(ret);
     }
     else
     {
         throw new NotSupportedException("VertexType is not supported!");
     }
 }
Example #2
0
 public ILVertexRenderer CreateVertexRenderer(Type vertexType, ILShape shape) {
     if (vertexType == typeof(C4bV3f)) {
         ILVertexRenderer ret;  
         if (shape is ILQuads) {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Quads); 
         } else if (shape is ILPolygon) {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Polygon); 
         } else if (shape is ILLine) {
             ret = new ILOGLLineRendererC4bV3f(shape.VertexCount); 
             ret.CloseLines = false; 
         } else if (shape is ILTriangle) {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Triangles); 
         } else if (shape is ILQuad) {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Quads); 
         } else if (shape is ILLines) {
             ret = new ILOGLLinesRendererC4bV3f(); 
         } else if (shape is ILTriangles) {
             ret = new ILOGLVertexRendererC4bV3f(BeginMode.Triangles); 
         } else if (shape is ILPoints) {
             ret = new ILOGLPointsRendererC4bV3f(); 
         } else 
             throw new NotSupportedException ("Shape of type " + shape.GetType().Name + " is not supported!"); 
         return ret; 
     } else if (vertexType == typeof(C4fN3fV3f)) {
         ILOGLVertexRendererC4fN3fV3f ret; 
         if (shape is ILLitQuads) {
             ret = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Quads); 
             ret.UseLight = true;
         } else if (shape is ILLitPolygon) {
             ret = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Polygon);
             ret.UseLight = true;
         } else if (shape is ILLitQuad) {
             ret = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Quads);
             ret.UseLight = true;
         } else if (shape is ILLitTriangle) {
             ret = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Triangles);
             ret.UseLight = true;
         } else if (shape is ILLitSphere) {
             ret = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Triangles);
             ret.UseLight = true;
         } else if (shape is ILLitTriangles) {
             ret = new ILOGLVertexRendererC4fN3fV3f(BeginMode.Triangles);
             ret.UseLight = true;
         } else {
             throw new NotSupportedException("Shape of type " + shape.GetType().Name + " is not supported for vertex type " + vertexType.Name + "!"); 
         }
         return ret; 
     } else {
         throw new NotSupportedException("VertexType is not supported!"); 
     }
 }