public static IVertexBuffer New(VideoTypes videoType, IDisposableResource parent, IBufferLayoutDesc bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices, int[] indices) { IVertexBuffer api = null; #if WIN32 if (videoType == VideoTypes.D3D9) api = new D3D9.VertexBuffer(parent, bufferLayoutDesc, usage, topology, vertices, indices); #endif #if WIN32 || WINRT || WP8 if (videoType == VideoTypes.D3D11) api = new D3D11.VertexBuffer(parent, bufferLayoutDesc, usage, topology, vertices, indices); #endif #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl if (videoType == VideoTypes.OpenGL) api = new OpenGL.VertexBuffer(parent, bufferLayoutDesc, usage, topology, vertices, indices); #endif #if XNA if (videoType == VideoTypes.XNA) api = new XNA.VertexBuffer(parent, bufferLayoutDesc, usage, topology, vertices, indices); #endif #if VITA if (videoType == VideoTypes.Vita) api = new Vita.VertexBuffer(parent, bufferLayoutDesc, usage, topology, vertices, indices); #endif if (api == null) Debug.ThrowError("VertexBufferAPI", "Unsuported InputType: " + videoType); return api; }
public VertexBuffer(IDisposableResource parent, IBufferLayoutDesc bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices, int[] indices) : base(parent, bufferLayoutDesc, usage, vertices) { init(parent, bufferLayoutDesc, usage, topology, vertices, indices); }
private void init(IDisposableResource parent, IBufferLayoutDesc bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices, int[] indices) { try { var video = parent.FindParentOrSelfWithException<Video>(); this.topology = topology; REIGN_D3D_PRIMITIVE_TOPOLOGY topologyType = REIGN_D3D_PRIMITIVE_TOPOLOGY.TRIANGLELIST; switch (topology) { case VertexBufferTopologys.Triangle: topologyType = REIGN_D3D_PRIMITIVE_TOPOLOGY.TRIANGLELIST; break; case VertexBufferTopologys.Line: topologyType = REIGN_D3D_PRIMITIVE_TOPOLOGY.LINELIST; break; case VertexBufferTopologys.Point: topologyType = REIGN_D3D_PRIMITIVE_TOPOLOGY.POINTLIST; break; } com = new VertexBufferCom(video.com, topologyType); var bufferUsage = (usage == BufferUsages.Write) ? REIGN_D3D11_USAGE.DYNAMIC : REIGN_D3D11_USAGE.DEFAULT; var cpuUsage = (usage == BufferUsages.Write) ? REIGN_D3D11_CPU_ACCESS_FLAG.WRITE : (REIGN_D3D11_CPU_ACCESS_FLAG)0; var error = com.Init(vertices, vertexCount, vertexByteSize, bufferUsage, cpuUsage); if (error == VertexBufferErrors.Buffer) Debug.ThrowError("VertexBuffer", "Failed to create Buffer"); if (indices != null && indices.Length != 0) indexBuffer = new IndexBuffer(this, usage, indices); } catch (Exception e) { Dispose(); throw e; } }
public static IVertexBuffer New(IDisposableResource parent, IBufferLayoutDesc bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices) { return New(VideoAPI.DefaultAPI, parent, bufferLayoutDesc, usage, topology, vertices, null); }
public VertexBuffer(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices) : base(parent, bufferLayoutDesc, bufferUsage, vertices) { init(parent, bufferLayoutDesc, bufferUsage, vertexBufferTopology, vertices, indices); }
public static VertexBuffer New(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices, int[] indices) { return new VertexBuffer(parent, bufferLayoutDesc, usage, topology, vertices, indices); }
private void init(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices) { try { video = parent.FindParentOrSelfWithException<Video>(); Topology = vertexBufferTopology; bufferLayout = new BufferLayout(this, null, bufferLayoutDesc, true); vertexBuffer = new X.VertexBuffer(video.Device, bufferLayout.layout, vertexCount, X.BufferUsage.WriteOnly); Update(vertices, vertexCount); if (indices != null && indices.Length != 0) indexBuffer = new IndexBuffer(this, usage, indices); } catch (Exception e) { Dispose(); throw e; } }
private void init(IDisposableResource parent, IBufferLayoutDesc bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices, int[] indices) { try { var video = parent.FindParentOrSelfWithException<Video>(); this.topology = topology; REIGN_D3DPRIMITIVETYPE topologyType = REIGN_D3DPRIMITIVETYPE.TRIANGLELIST; switch (topology) { case VertexBufferTopologys.Triangle: topologyType = REIGN_D3DPRIMITIVETYPE.TRIANGLELIST; break; case VertexBufferTopologys.Line: topologyType = REIGN_D3DPRIMITIVETYPE.LINELIST; break; case VertexBufferTopologys.Point: topologyType = REIGN_D3DPRIMITIVETYPE.POINTLIST; break; } com = new VertexBufferCom(video.com, topologyType); var error = com.Init(vertices, REIGN_D3DUSAGE.WRITEONLY, vertexCount, vertexByteSize); if (error == VertexBufferErrors.VertexBuffer) Debug.ThrowError("VertexBuffer", "Failed to create VertexBuffer"); if (indices != null && indices.Length != 0) indexBuffer = new IndexBuffer(this, usage, indices); } catch (Exception e) { Dispose(); throw e; } }
private void init(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices) { try { video = parent.FindParentOrSelfWithException <Video>(); Topology = vertexBufferTopology; bufferLayout = new BufferLayout(this, null, bufferLayoutDesc, true); vertexBuffer = new X.VertexBuffer(video.Device, bufferLayout.layout, vertexCount, X.BufferUsage.WriteOnly); Update(vertices, vertexCount); if (indices != null && indices.Length != 0) { indexBuffer = new IndexBuffer(this, usage, indices); } } catch (Exception e) { Dispose(); throw e; } }
public VertexBuffer(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices) : base(parent, bufferLayoutDesc, bufferUsage, vertices) { init(parent, bufferLayoutDesc, bufferUsage, vertexBufferTopology, vertices, indices); }
public static VertexBuffer New(DisposableI parent, BufferLayoutDescI bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices, int[] indices) { return(new VertexBuffer(parent, bufferLayoutDesc, usage, topology, vertices, indices)); }