예제 #1
0
void RenderHelper::DrawPolygon(const Polygon3 & polygon, bool closed)
{
    int ptCount = polygon.pointCount;
	if (ptCount >= 2)
	{		
		vertexStream->Set(TYPE_FLOAT, 3, 0, polygon.GetPoints());
		RenderManager::Instance()->SetRenderEffect(RenderManager::FLAT_COLOR);
		RenderManager::Instance()->SetRenderData(renderDataObject);
		RenderManager::Instance()->DrawArrays(PRIMITIVETYPE_LINESTRIP, 0, ptCount);
		
		if (closed)
		{
		    Vector3 line[2] = {Vector3(polygon.GetPoints()[0]), Vector3(polygon.GetPoints()[ptCount-1])};
		    vertexStream->Set(TYPE_FLOAT, 3, 0, line);
		    RenderManager::Instance()->DrawArrays(PRIMITIVETYPE_LINESTRIP, 0, 2);
		}
    }

	
}
예제 #2
0
void RenderHelper::FillPolygon(const Polygon3 & polygon)
{
    int ptCount = polygon.pointCount;
	if (ptCount >= 3)
	{		
		vertexStream->Set(TYPE_FLOAT, 3, 0, polygon.GetPoints());
		RenderManager::Instance()->SetRenderEffect(RenderManager::FLAT_COLOR);
		RenderManager::Instance()->SetRenderData(renderDataObject);
		RenderManager::Instance()->DrawArrays(PRIMITIVETYPE_TRIANGLEFAN, 0, ptCount);
    }

}
예제 #3
0
void RenderHelper::DrawPolygonPoints(const Polygon3 & polygon)
{
	int ptCount = polygon.pointCount;
	if (ptCount >= 1)
	{
#if defined (__DAVAENGINE_OPENGL__)
        glPointSize(3.0f);
#endif 
		vertexStream->Set(TYPE_FLOAT, 3, 0, polygon.GetPoints());
		RenderManager::Instance()->SetRenderEffect(RenderManager::FLAT_COLOR);
		RenderManager::Instance()->SetRenderData(renderDataObject);
		RenderManager::Instance()->DrawArrays(PRIMITIVETYPE_POINTLIST, 0, ptCount);
#if defined (__DAVAENGINE_OPENGL__)
		glPointSize(1.0f);
#endif		
	}
	
}