internal override uint[] Search(RenderEventArgs arg, int x, int y, uint lastVertexId, ZeroIndexRenderer modernRenderer) { ZeroIndexBufferPtr zeroIndexBufferPtr = modernRenderer.IndexBufferPtr; ZeroIndexBufferPtr indexBufferPtr = null; // when the temp index buffer could be long, it's no longer needed. // what a great OpenGL API design! using (var buffer = new ZeroIndexBuffer(DrawMode.LineLoop, zeroIndexBufferPtr.FirstVertex, zeroIndexBufferPtr.VertexCount)) { indexBufferPtr = buffer.GetBufferPtr() as ZeroIndexBufferPtr; } modernRenderer.Render4InnerPicking(arg, indexBufferPtr); uint id = ColorCodedPicking.ReadPixel(x, y, arg.CanvasRect.Height); indexBufferPtr.Dispose(); if (id == zeroIndexBufferPtr.FirstVertex) { return(new uint[] { (uint)(zeroIndexBufferPtr.FirstVertex + zeroIndexBufferPtr.VertexCount - 1), id, }); } else { return(new uint[] { id - 1, id, }); } }
public IndexBufferPtr GetIndex() { if (indexBufferPtr == null) { using (var buffer = new ZeroIndexBuffer( DrawMode.LineStrip, 0, BigDipperModel.positions.Length)) { indexBufferPtr = buffer.GetBufferPtr() as IndexBufferPtr; } //using (var buffer = new OneIndexBuffer<uint>( // DrawMode.Lines, BufferUsage.StaticDraw)) //{ // buffer.Alloc(BigDipperModel.positions.Length); // unsafe // { // var array = (uint*)buffer.Header.ToPointer(); // for (uint i = 0; i < BigDipperModel.positions.Length; i++) // { // array[i] = i; // } // array[0] = uint.MaxValue; // array[4] = uint.MaxValue; // array[10] = uint.MaxValue; // } // indexBufferPtr = buffer.GetBufferPtr() as IndexBufferPtr; //} } return indexBufferPtr; }
internal override uint Search(RenderEventArgs arg, int x, int y, uint lastVertexId, ZeroIndexRenderer modernRenderer) { ZeroIndexBufferPtr zeroIndexBufferPtr = modernRenderer.IndexBufferPtr; ZeroIndexBufferPtr indexBufferPtr = null; // when the temp index buffer could be long, it's no longer needed. // what a great OpenGL API design! using (var buffer = new ZeroIndexBuffer(DrawMode.Points, zeroIndexBufferPtr.FirstVertex, zeroIndexBufferPtr.VertexCount)) { indexBufferPtr = buffer.GetBufferPtr() as ZeroIndexBufferPtr; } modernRenderer.Render4InnerPicking(arg, indexBufferPtr); uint id = ColorCodedPicking.ReadPixel(x, y, arg.CanvasRect.Height); indexBufferPtr.Dispose(); if (zeroIndexBufferPtr.FirstVertex <= id && id < zeroIndexBufferPtr.FirstVertex + zeroIndexBufferPtr.VertexCount) { return(id); } else { throw new Exception("This should not happen!"); } }
/// <summary> /// /// </summary> /// <returns></returns> public IndexBufferPtr GetIndexBufferPtr() { if (indexBufferPtr == null) { using (var buffer = new ZeroIndexBuffer( DrawMode.LineStrip, 0, BigDipperModel.positions.Length)) { indexBufferPtr = buffer.GetBufferPtr(); } //using (var buffer = new OneIndexBuffer<uint>( // DrawMode.Lines, BufferUsage.StaticDraw)) //{ // buffer.Alloc(BigDipperModel.positions.Length); // unsafe // { // var array = (uint*)buffer.Header.ToPointer(); // for (uint i = 0; i < BigDipperModel.positions.Length; i++) // { // array[i] = i; // } // array[0] = uint.MaxValue; // array[4] = uint.MaxValue; // array[10] = uint.MaxValue; // } // indexBufferPtr = buffer.GetBufferPtr(); //} } return(indexBufferPtr); }
public CSharpGL.IndexBufferPtr GetIndexBufferPtr() { if ((indexBufferPtr == null)) { using (var buffer = new ZeroIndexBuffer(DrawMode.Points, 0, this.pointCount)) {// begin of using indexBufferPtr = buffer.GetBufferPtr(); }// end of using } return(indexBufferPtr); }
public IndexBufferPtr GetIndex() { if (this.indexBufferPtr == null) { using (var buffer = new ZeroIndexBuffer(DrawMode.Lines, 0, codedColors.Length * 2 + 4)) { this.indexBufferPtr = buffer.GetBufferPtr() as IndexBufferPtr; } } return this.indexBufferPtr; }
/// <summary> /// /// </summary> /// <returns></returns> public IndexBufferPtr GetIndex() { if (indexBufferPtr == null) { using (var buffer = new ZeroIndexBuffer(this.model.GetDrawModel(), 0, this.model.positions.Length)) { indexBufferPtr = buffer.GetBufferPtr() as IndexBufferPtr; } } return(indexBufferPtr); }
/// <summary> /// /// </summary> /// <returns></returns> public IndexBufferPtr GetIndexBufferPtr() { if (this.indexBufferPtr == null) { using (var buffer = new ZeroIndexBuffer(this.Mode, this.FirstVertex, this.VertexCount, this.PrimCount)) { this.indexBufferPtr = buffer.GetBufferPtr(); } } return(this.indexBufferPtr); }
/// <summary> /// /// </summary> /// <returns></returns> public IndexBufferPtr GetIndex() { if (indexBufferPtr == null) { using (var buffer = new ZeroIndexBuffer( DrawMode.Quads, 0, maxCharCount * 4)) { indexBufferPtr = buffer.GetBufferPtr() as ZeroIndexBufferPtr; } } return(indexBufferPtr); }
/// <summary> /// /// </summary> /// <returns></returns> public IndexBufferPtr GetIndex() { if (indexBufferPtr == null) { using (var buffer = new ZeroIndexBuffer( DrawMode.QuadStrip, 0, positions.Length)) { indexBufferPtr = buffer.GetBufferPtr() as IndexBufferPtr; } } return(indexBufferPtr); }
/// <summary> /// /// </summary> /// <returns></returns> public IndexBufferPtr GetIndexBufferPtr() { if (indexBufferPtr == null) { using (var buffer = new ZeroIndexBuffer( DrawMode.LineStrip, 0, this.model.Positions.Length)) { indexBufferPtr = buffer.GetBufferPtr(); } } return(indexBufferPtr); }
internal override uint[] Search(RenderEventArgs arg, int x, int y, uint lastVertexId, ZeroIndexRenderer modernRenderer) { ZeroIndexBufferPtr zeroIndexBufferPtr = modernRenderer.IndexBufferPtr; ZeroIndexBufferPtr indexBufferPtr = null; // when the temp index buffer could be long, it's no longer needed. // what a great OpenGL API design! using (var buffer = new ZeroIndexBuffer(DrawMode.LineLoop, zeroIndexBufferPtr.FirstVertex, zeroIndexBufferPtr.VertexCount)) { indexBufferPtr = buffer.GetBufferPtr() as ZeroIndexBufferPtr; } modernRenderer.Render4InnerPicking(arg, indexBufferPtr); uint id = ColorCodedPicking.ReadPixel(x, y, arg.CanvasRect.Height); indexBufferPtr.Dispose(); if (id == zeroIndexBufferPtr.FirstVertex) { return new uint[] { (uint)(zeroIndexBufferPtr.FirstVertex + zeroIndexBufferPtr.VertexCount - 1), id, }; } else { return new uint[] { id - 1, id, }; } }
internal override uint Search(RenderEventArg arg, int x, int y, uint lastVertexId, ZeroIndexRenderer modernRenderer) { ZeroIndexBufferPtr zeroIndexBufferPtr = modernRenderer.IndexBufferPtr; ZeroIndexBufferPtr indexBufferPtr = null; // when the temp index buffer could be long, it's no longer needed. // what a great OpenGL API design! using (var buffer = new ZeroIndexBuffer(DrawMode.Points, zeroIndexBufferPtr.FirstVertex, zeroIndexBufferPtr.VertexCount)) { indexBufferPtr = buffer.GetBufferPtr() as ZeroIndexBufferPtr; } modernRenderer.Render4InnerPicking(arg, indexBufferPtr); uint id = ColorCodedPicking.ReadPixel(x, y, arg.CanvasRect.Height); indexBufferPtr.Dispose(); if (zeroIndexBufferPtr.FirstVertex <= id && id < zeroIndexBufferPtr.FirstVertex + zeroIndexBufferPtr.VertexCount) { return id; } else { throw new Exception("This should not happen!"); } }