Geometry ClassDelta Engine Documentation
Base class for GPU geometry data. View code on GitHub
Inheritance Hierarchy

System Object
  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

public abstract class Geometry : ContentData

The Geometry type exposes the following members.

Constructors

  NameDescription
Protected methodGeometry(String)
Initializes a new instance of the Geometry class
Protected methodGeometry(GeometryCreationData)
Initializes a new instance of the Geometry class
Top
Methods

  NameDescription
Protected methodCreateDefault (Inherited from ContentData.)
Public methodDispose (Inherited from ContentData.)
Protected methodDisposeData (Inherited from ContentData.)
Public methodDraw
Public methodInternalCreateDefault (Inherited from ContentData.)
Protected methodLoadData (Overrides ContentData LoadData(Stream).)
Public methodLoadFromFile
Public methodSetData( Byte ,  Int16 )
Public methodSetData( Vertex ,  Int16 )
Protected methodSetNativeData
Public methodToString (Inherited from ContentData.)
Top
Fields

  NameDescription
Protected fieldContentChanged (Inherited from ContentData.)
Top
Properties

  NameDescription
Protected propertyAllowCreationIfContentNotFound (Inherited from ContentData.)
Public propertyFormat
Public propertyHasAnimationData
Public propertyIsDisposed (Inherited from ContentData.)
Public propertyMetaData (Inherited from ContentData.)
Public propertyName (Inherited from ContentData.)
Public propertyNumberOfIndices
Public propertyNumberOfVertices
Public propertyTransformsOfBones
Top
Remarks

Tests: DeltaEngine.Graphics.Tests.GeometryTests
Examples

10 unit tests call DeltaEngine.Graphics.Geometry
[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