Base class for GPU geometry data.
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Content ContentData
DeltaEngine.Graphics Geometry
DeltaEngine.Graphics.BaseOpenGL11 OpenGL11Geometry
DeltaEngine.Graphics.BaseOpenGL20 OpenGL20Geometry
DeltaEngine.Graphics.Mocks MockGeometry
DeltaEngine.Graphics.SharpDX SharpDXGeometry
DeltaEngine.Graphics.SlimDX SlimDXGeometry
DeltaEngine.Graphics.Xna XnaGeometry
Namespace: DeltaEngine.Graphics
Assembly: DeltaEngine.Graphics (in DeltaEngine.Graphics.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The Geometry type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Geometry(String) | Initializes a new instance of the Geometry class | |
Geometry(GeometryCreationData) | Initializes a new instance of the Geometry class |
Methods
Name | Description | |
---|---|---|
CreateDefault | (Inherited from ContentData.) | |
Dispose | (Inherited from ContentData.) | |
DisposeData | (Inherited from ContentData.) | |
Draw | ||
InternalCreateDefault | (Inherited from ContentData.) | |
LoadData | (Overrides ContentData LoadData(Stream).) | |
LoadFromFile | ||
SetData( Byte , Int16 ) | ||
SetData( Vertex , Int16 ) | ||
SetNativeData | ||
ToString | (Inherited from ContentData.) |
Fields
Name | Description | |
---|---|---|
ContentChanged | (Inherited from ContentData.) |
Properties
Name | Description | |
---|---|---|
AllowCreationIfContentNotFound | (Inherited from ContentData.) | |
Format | ||
HasAnimationData | ||
IsDisposed | (Inherited from ContentData.) | |
MetaData | (Inherited from ContentData.) | |
Name | (Inherited from ContentData.) | |
NumberOfIndices | ||
NumberOfVertices | ||
TransformsOfBones |
Remarks
Examples
[Test, CloseAfterFirstFrame] public void SetInvalidDataThrows() { var geometry = ContentLoader.Create<Geometry>(new GeometryCreationData(VertexFormat.Position3DColor, 1, 1)); Assert.Throws<Geometry.InvalidNumberOfVertices>( () => geometry.SetData(new Vertex[] { }, new short[] { 0 })); Assert.Throws<Geometry.InvalidNumberOfIndices>( () => geometry.SetData(new Vertex[] { new VertexPosition3DColor(Vector3D.Zero, Color.Red) }, new short[] { })); }
[Test, CloseAfterFirstFrame] public void LoadInvalidDataThrows() { var creationData = new GeometryCreationData(VertexFormat.Position3DColor, 1, 1); var geometry = ContentLoader.Create<TestGeometry>(creationData); Assert.Throws<Geometry.EmptyGeometryFileGiven>(geometry.LoadInvalidData); }
[Test, CloseAfterFirstFrame] public void CreateGeometry() { var creationData = new GeometryCreationData(VertexFormat.Position3DColor, 1, 1); var geometry = ContentLoader.Create<TestGeometry>(creationData); geometry.LoadValidData(); Assert.AreEqual(6, geometry.NumberOfIndices); Assert.AreEqual(1, geometry.NumberOfVertices); geometry.LoadFromFile(TestGeometry.CreateValidData()); Assert.AreEqual(6, geometry.NumberOfIndices); Assert.AreEqual(1, geometry.NumberOfVertices); Assert.AreEqual(VertexFormat.Position3DColor, geometry.Format); }
See Also