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; } }
public static IQuickDraw New(VideoTypes videoType, IDisposableResource parent, IBufferLayoutDesc desc) { IQuickDraw api = null; #if WIN32 if (videoType == VideoTypes.D3D9) api = new D3D9.QuickDraw(parent, desc); #endif #if WIN32 || WINRT || WP8 if (videoType == VideoTypes.D3D11) api = new D3D11.QuickDraw(parent, desc); #endif #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl if (videoType == VideoTypes.OpenGL) api = new OpenGL.QuickDraw(parent, desc); #endif #if XNA if (videoType == VideoTypes.XNA) api = new XNA.QuickDraw(parent, desc); #endif #if VITA if (videoType == VideoTypes.Vita) api = new Vita.QuickDraw(parent, desc); #endif if (api == null) Debug.ThrowError("QuickDrawAPI", "Unsuported InputType: " + videoType); return api; }
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 QuickDraw(IDisposableResource parent, IBufferLayoutDesc bufferLayoutDesc) : base(parent, bufferLayoutDesc) { try { vertexBuffer = new VertexBuffer(this, bufferLayoutDesc, BufferUsages.Write, VertexBufferTopologys.Triangle, vertices); } catch (Exception e) { Dispose(); throw e; } }
public BufferLayout(IDisposableResource parent, IShader shader, IBufferLayoutDesc desc) : base(parent) { video = parent.FindParentOrSelfWithException<Video>(); this.shader = (Shader)shader; enabledStreamIndices = new bool[2]; streamBytesSizes = desc.StreamBytesSizes; layout = ((BufferLayoutDesc)desc).desc; attribLocations = new int[layout.Length]; for (int i = 0; i != layout.Length; ++i) { attribLocations[i] = GL.GetAttribLocation(this.shader.program, layout[i].Name); Video.checkForError(); } }
public BufferLayout(IDisposableResource parent, IShader shader, IBufferLayoutDesc desc) : base(parent) { video = parent.FindParentOrSelfWithException <Video>(); this.shader = (Shader)shader; enabledStreamIndices = new bool[2]; streamBytesSizes = desc.StreamBytesSizes; layout = ((BufferLayoutDesc)desc).desc; attribLocations = new int[layout.Length]; for (int i = 0; i != layout.Length; ++i) { attribLocations[i] = GL.GetAttribLocation(this.shader.program, layout[i].Name); Video.checkForError(); } }
public BufferLayout(IDisposableResource parent, IShader shader, IBufferLayoutDesc desc) : base(parent) { try { var video = parent.FindParentOrSelfWithException<Video>(); com = new BufferLayoutCom(); var error = com.Init(video.com, ((Shader)shader).vertex.com, ((BufferLayoutDesc)desc).com); if (error == BufferLayoutErrors.InputLayout) Debug.ThrowError("BufferLayout", "Failed to create InputLayout"); } catch (Exception e) { Dispose(); throw e; } }
public static IBufferLayoutDesc New(VideoTypes videoType, List <BufferLayoutElement> elements) { IBufferLayoutDesc api = null; #if WIN32 if (videoType == VideoTypes.D3D9) { api = new D3D9.BufferLayoutDesc(elements); } #endif #if WIN32 || WINRT || WP8 if (videoType == VideoTypes.D3D11) { api = new D3D11.BufferLayoutDesc(elements); } #endif #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl if (videoType == VideoTypes.OpenGL) { api = new OpenGL.BufferLayoutDesc(elements); } #endif #if XNA if (videoType == VideoTypes.XNA) { api = new XNA.BufferLayoutDesc(elements); } #endif #if VITA if (videoType == VideoTypes.Vita) { api = new Vita.BufferLayoutDesc(elements); } #endif if (api == null) { Debug.ThrowError("BufferLayoutDescAPI", "Unsuported InputType: " + videoType); } return(api); }
public BufferLayout(IDisposableResource parent, IShader shader, IBufferLayoutDesc desc) : base(parent) { try { var video = parent.FindParentOrSelfWithException <Video>(); com = new BufferLayoutCom(); var error = com.Init(video.com, ((Shader)shader).vertex.com, ((BufferLayoutDesc)desc).com); if (error == BufferLayoutErrors.InputLayout) { Debug.ThrowError("BufferLayout", "Failed to create InputLayout"); } } catch (Exception e) { Dispose(); throw e; } }
public BufferLayout(IDisposableResource parent, IShader shader, IBufferLayoutDesc desc) : base(parent) { try { var video = parent.FindParentOrSelfWithException <Video>(); com = new BufferLayoutCom(); var error = com.Init(video.com, ((BufferLayoutDesc)desc).com); switch (error) { case BufferLayoutErrors.VertexDeclaration: Debug.ThrowError("BufferLayout", "Failed to create vertex declaration"); break; } } 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_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; } }
private unsafe void init(IDisposableResource parent, IBufferLayoutDesc bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices, int[] indices) { try { video = parent.FindParentOrSelfWithException <Video>(); Topology = vertexBufferTopology; uint vPtr = 0; GL.GenBuffers(1, &vPtr); vertexBuffer = vPtr; if (vertexBuffer == 0) { Debug.ThrowError("VertexBuffer", "Failed to create VertexBuffer"); } GL.BindBuffer(GL.ARRAY_BUFFER, vertexBuffer); fixed(float *verticesPtr = vertices) { var bufferSize = new IntPtr(vertexByteSize * vertexCount); GL.BufferData(GL.ARRAY_BUFFER, bufferSize, verticesPtr, GL.STATIC_DRAW); } Video.checkForError(); if (indices != null && indices.Length != 0) { indexBuffer = new IndexBuffer(this, usage, indices); } } catch (Exception e) { Dispose(); throw e; } }
public VertexBuffer(IDisposableResource parent, IBufferLayoutDesc bufferLayoutDesc, BufferUsages bufferUsage, VertexBufferTopologys vertexBufferTopology, float[] vertices) : base(parent, bufferLayoutDesc, bufferUsage, vertices) { init(parent, bufferLayoutDesc, bufferUsage, vertexBufferTopology, vertices, null); }
public static IQuickDraw New(IDisposableResource parent, IBufferLayoutDesc desc) { return(New(parent, desc)); }
public static IQuickDraw New(VideoTypes videoType, IDisposableResource parent, IBufferLayoutDesc desc) { IQuickDraw api = null; #if WIN32 if (videoType == VideoTypes.D3D9) { api = new D3D9.QuickDraw(parent, desc); } #endif #if WIN32 || WINRT || WP8 if (videoType == VideoTypes.D3D11) { api = new D3D11.QuickDraw(parent, desc); } #endif #if WIN32 || OSX || LINUX || iOS || ANDROID || NaCl if (videoType == VideoTypes.OpenGL) { api = new OpenGL.QuickDraw(parent, desc); } #endif #if XNA if (videoType == VideoTypes.XNA) { api = new XNA.QuickDraw(parent, desc); } #endif #if VITA if (videoType == VideoTypes.Vita) { api = new Vita.QuickDraw(parent, desc); } #endif if (api == null) { Debug.ThrowError("QuickDrawAPI", "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 IQuickDraw New(IDisposableResource parent, IBufferLayoutDesc desc) { return New(parent, desc); }
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 static IBufferLayout New(IDisposableResource parent, IShader shader, IBufferLayoutDesc desc) { return(New(VideoAPI.DefaultAPI, parent, shader, desc)); }
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 static IVertexBuffer New(IDisposableResource parent, IBufferLayoutDesc bufferLayoutDesc, BufferUsages usage, VertexBufferTopologys topology, float[] vertices) { return(New(VideoAPI.DefaultAPI, parent, bufferLayoutDesc, usage, topology, vertices, null)); }