protected void SetVertexBuffer <V>(IVertexParser <V> vertexParser) where V : struct { numVertices = vertexParser.VertexCount; vertexStride = Marshal.SizeOf(typeof(V)); int SizeOfVertexBufferInBytes = numVertices * vertexStride; vertices = new DataStream(SizeOfVertexBufferInBytes, true, true); for (int i = 0; i < numVertices; i++) { vertexParser.FillVertex(i, out V vertex); vertices.Write(vertex); } vertices.Position = 0; boundingBox = BoundingBox.FromPoints(vertices, numVertices, vertexStride); boundingSphere = BoundingSphere.FromBox(boundingBox); vertexBuffer = new Buffer(DeviceManager.Instance.device, vertices, SizeOfVertexBufferInBytes, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0); }
public ObjLoader(IVertexParser vertexParser, INormalParser normalParser, IFaceParser faceParser, ITextureParser textureParser, ILogger logger) { _textureParser = textureParser; _logger = logger; _faceParser = faceParser; _normalParser = normalParser; _vertexParser = vertexParser; }
public OmeLoader(IDataStore dataStore, IOctreeParser octreeParser, ITriangleParser triangleParser, IIndexParser indexParser, IVertexParser vertexParser) { _headerLineCount = 11; _dataStore = dataStore; _octreeParser = octreeParser; _triangleParser = triangleParser; _indexParser = indexParser; _vertexParser = vertexParser; }
public ObjLoader( IDataStore dataStore, IFaceParser faceParser, IGroupParser groupParser, INormalParser normalParser, ITextureParser textureParser, IVertexParser vertexParser, IMaterialLibraryParser materialLibraryParser, IUseMaterialParser useMaterialParser) { _dataStore = dataStore; SetupTypeParsers( vertexParser, faceParser, normalParser, textureParser, groupParser, materialLibraryParser, useMaterialParser); }
public ObjLoader( IDataStore dataStore, IFaceParser faceParser, IGroupParser groupParser, INormalParser normalParser, ITextureParser textureParser, IVertexParser vertexParser, IMaterialLibraryParser materialLibraryParser, IUseMaterialParser useMaterialParser) { _dataStore = dataStore; SetupTypeParsers( vertexParser, faceParser, normalParser, textureParser, groupParser, materialLibraryParser, useMaterialParser); }