/// <summary> /// Makes CryEngine recognize any changes made to this mesh. /// </summary> /// <param name="staticObject"> Static object that will host the mesh. </param> public abstract void Export(StaticObject staticObject);
/// <summary> /// Initializes new wrapper object for native mesh. /// </summary> /// <param name="obj">Static object that hosts the mesh.</param> public NativeMesh(StaticObject obj) { if (obj.Disposed) { throw new ObjectDisposedException("Cannot acquire mesh data from static" + " object that has been disposed of."); } MeshHandles handles = StaticObjectInterop.GetMeshHandles(obj.Handle); if (handles.IndexedMeshHandle == IntPtr.Zero || handles.MeshHandle == IntPtr.Zero) { throw new Exception("Unable to acquire mesh handles for the static object."); } this.CMeshHandle = handles.MeshHandle; this.IndexedMeshHandle = handles.IndexedMeshHandle; this.StaticObject = obj; this.colors0 = new NativeVertexColor0Collection(this); this.colors1 = new NativeVertexColor1Collection(this); this.faces = new NativeFaceCollection(this.CMeshHandle); this.indices = new NativeIndicesCollection(this); this.positions = new NativeVertexPositionCollection(this); this.normals = new NativeVertexNormalCollection(this); this.tangents = new NativeVertexTangentCollection(this); this.qTangents = new NativeVertexQTangentCollection(this); this.texCoords = new NativeVertexTextureCoordinatesCollection(this); }
/// <summary> /// Signals underlying static object to create a new render mesh. /// </summary> /// <param name="staticObject">Ignored.</param> public override void Export(StaticObject staticObject) { MeshInterop.Export(this.StaticObject.Handle); }
/// <summary> /// Assigns a static object to a specified slot. /// </summary> /// <param name="staticObject">Static object to assign to the entity.</param> /// <param name="slot"> /// Index of the slot where to put the static object. /// </param> public void AssignStaticObject(StaticObject staticObject, int slot) { if (staticObject.Disposed) { throw new ObjectDisposedException ("staticObject", "Attempt to assign disposed or invalid static object to the entity."); } this.AssertObjectValidity(); Native.EntityInterop.AssignStaticObject(this.Handle, staticObject.Handle, slot); }