C# Class CSharpGL.OneIndexRenderer

Show file Open project: bitzhuwei/CSharpGL Class Usage Examples

Public Methods

Method Description
GetPickedGeometry ( RenderEventArgs arg, uint stageVertexId, int x, int y ) : PickedGeometry

Private Methods

Method Description
ArrangeIndexes ( RecognizedPrimitiveInfo recognizedPrimitiveIndex0, RecognizedPrimitiveInfo recognizedPrimitiveIndex1, DrawMode drawMode, uint &lastIndex0, uint &lastIndex1 ) : List

将共享点前移,构成2个图元组成的新的小小的索引。

AssembleIndexBuffer ( RecognizedPrimitiveInfo recognizedPrimitiveIndex0, RecognizedPrimitiveInfo recognizedPrimitiveIndex1, DrawMode drawMode, OneIndexBuffer &oneIndexBuffer, uint &lastIndex0, uint &lastIndex1 ) : void

将共享点前移,然后重新渲染、拾取

GetLastIndexId ( RenderEventArgs arg, List primitiveInfoList, int x, int y ) : RecognizedPrimitiveInfo

在所有可能的图元(lastVertexId匹配)中, 逐个测试,找到最接近摄像机的那个图元, 返回此图元的最后一个索引在IndexBuffer中的索引(位置)。

GetLastIndexIdList ( RenderEventArgs arg, uint lastVertexId ) : List

遍历以lastVertexId为最后一个顶点的图元, 瞄准每个图元的索引(例如1个三角形有3个索引)中的最后一个索引, 将此索引在IndexBuffer中的索引(位置)收集起来。

GetLastIndexIdOfPickedGeometry ( RenderEventArgs arg, uint lastVertexId, int x, int y ) : RecognizedPrimitiveInfo

GetLineSearcher ( DrawMode mode ) : CSharpGL.OneIndexLineSearcher
GetPointSearcher ( DrawMode mode ) : OneIndexPointSearcher
GetPrimitiveRestartState ( ) : PrimitiveRestartState
NoPrimitiveRestartIndex ( List primitiveInfoList ) : void
OnPrimitiveTest ( uint lastVertexId, DrawMode mode ) : bool

I don't know how to implement this method in a high effitiency way. So keep it like this. Also, why would someone use glDrawElements() when rendering GL_POINTS?

OneIndexRenderer ( IBufferable model, ShaderCode shaderCodes, AttributeMap attributeMap, string positionNameInIBufferable )

用glDrawElements进行渲染。

Pick ( RenderEventArgs arg, OneIndexBuffer twoPrimitivesIndexBuffer, int x, int y ) : uint

PickPoint ( RenderEventArgs arg, uint stageVertexId, uint lastVertexId ) : PickedGeometry
PickWhateverItIs ( RenderEventArgs arg, uint stageVertexId, RecognizedPrimitiveInfo primitiveInfo, PickingGeometryType typeOfMode ) : PickedGeometry

是三角形,就pick一个三角形;是四边形,就pick一个四边形,是多边形,就pick一个多边形。

SameLengths ( List primitiveInfoList ) : void
SearchLine ( RenderEventArgs arg, uint stageVertexId, int x, int y, uint lastVertexId, RecognizedPrimitiveInfo primitiveInfo, CSharpGL.OneIndexLineSearcher searcher ) : PickedGeometry

SearchPoint ( RenderEventArgs arg, uint stageVertexId, int x, int y, uint lastVertexId, RecognizedPrimitiveInfo primitiveInfo, OneIndexPointSearcher searcher ) : PickedGeometry

Method Details

GetPickedGeometry() public method

public GetPickedGeometry ( RenderEventArgs arg, uint stageVertexId, int x, int y ) : PickedGeometry
arg RenderEventArgs
stageVertexId uint
x int mouse position(Left Down is (0, 0)).
y int mouse position(Left Down is (0, 0)).
return PickedGeometry