本文整理汇总了C#中Texture.uploadFromBitmapData方法的典型用法代码示例。如果您正苦于以下问题:C# Texture.uploadFromBitmapData方法的具体用法?C# Texture.uploadFromBitmapData怎么用?C# Texture.uploadFromBitmapData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Texture
的用法示例。
在下文中一共展示了Texture.uploadFromBitmapData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setGeometry
/**
* Upload geometry data, including a texture image
* @param vertices Vertex attribute data: x,y,z, nx,ny,nz, u,v (position, normal, texture)
* @param indices Face data
* @param textureBitmap An image to be used as the texture
*/
public void setGeometry(Vector<double> vertices, Vector<uint> indices, BitmapData textureBitmap)
{
// Upload vertex data
if (vertexBuffer != null) vertexBuffer.dispose();
vertexBuffer = context.createVertexBuffer((int)(vertices.length / DATA32_PER_VERTEX), (int)DATA32_PER_VERTEX);
vertexBuffer.uploadFromVector(vertices, 0, (int)(vertices.length / DATA32_PER_VERTEX));
// Upload polygon data (vertex indices)
if (indexBuffer != null) indexBuffer.dispose();
indexBuffer = context.createIndexBuffer((int)indices.length);
indexBuffer.uploadFromVector(indices, 0, (int)indices.length);
// Upload texture
if (texture3D != null) texture3D.dispose();
texture3D = context.createTexture(textureBitmap.width, textureBitmap.height, Context3DTextureFormat.BGRA, false);
texture3D.uploadFromBitmapData(textureBitmap);
}