Пример #1
0
void LineBatcher::DrawFrustum(const View& View, unsigned int Color) {
#if BUILD_RELEASE
  if (m_IsDebug) {
    return;
  }
#endif

  m_AddPositions.Resize(8);
  m_AddColors.Resize(8);
  m_AddIndices.Resize(24);

  Frustum Frustum;
  View.ApplyToFrustum(Frustum);
  Frustum.GetCorners(m_AddPositions.GetData());

  m_AddColors[0] = Color;
  m_AddColors[1] = Color;
  m_AddColors[2] = Color;
  m_AddColors[3] = Color;
  m_AddColors[4] = Color;
  m_AddColors[5] = Color;
  m_AddColors[6] = Color;
  m_AddColors[7] = Color;
  m_AddIndices[0] = 0;
  m_AddIndices[1] = 1;
  m_AddIndices[2] = 0;
  m_AddIndices[3] = 2;
  m_AddIndices[4] = 0;
  m_AddIndices[5] = 4;
  m_AddIndices[6] = 1;
  m_AddIndices[7] = 3;
  m_AddIndices[8] = 1;
  m_AddIndices[9] = 5;
  m_AddIndices[10] = 2;
  m_AddIndices[11] = 3;
  m_AddIndices[12] = 2;
  m_AddIndices[13] = 6;
  m_AddIndices[14] = 3;
  m_AddIndices[15] = 7;
  m_AddIndices[16] = 4;
  m_AddIndices[17] = 5;
  m_AddIndices[18] = 4;
  m_AddIndices[19] = 6;
  m_AddIndices[20] = 5;
  m_AddIndices[21] = 7;
  m_AddIndices[22] = 6;
  m_AddIndices[23] = 7;

  Add(m_AddPositions, m_AddColors, m_AddIndices);
}
Пример #2
0
void LineRenderer::DrawFrustum(const Frustum& frustum, const float4& color)
{
    float3 corners[8];
    frustum.GetCorners(corners);

    m_vertsPC.push_back(VertexPC(corners[0],color));      
    m_vertsPC.push_back(VertexPC(corners[1],color));      

    m_vertsPC.push_back(VertexPC(corners[1],color));      
    m_vertsPC.push_back(VertexPC(corners[2],color));      

    m_vertsPC.push_back(VertexPC(corners[2],color));      
    m_vertsPC.push_back(VertexPC(corners[3],color));      

    m_vertsPC.push_back(VertexPC(corners[3],color));      
    m_vertsPC.push_back(VertexPC(corners[0],color));      
    
    m_vertsPC.push_back(VertexPC(corners[4],color));      
    m_vertsPC.push_back(VertexPC(corners[5],color));      

    m_vertsPC.push_back(VertexPC(corners[5],color));      
    m_vertsPC.push_back(VertexPC(corners[6],color));      

    m_vertsPC.push_back(VertexPC(corners[6],color));      
    m_vertsPC.push_back(VertexPC(corners[7],color));      

    m_vertsPC.push_back(VertexPC(corners[7],color));      
    m_vertsPC.push_back(VertexPC(corners[4],color));      
    
    m_vertsPC.push_back(VertexPC(corners[0],color));      
    m_vertsPC.push_back(VertexPC(corners[4],color));      

    m_vertsPC.push_back(VertexPC(corners[1],color));      
    m_vertsPC.push_back(VertexPC(corners[5],color));      

    m_vertsPC.push_back(VertexPC(corners[2],color));      
    m_vertsPC.push_back(VertexPC(corners[6],color));      

    m_vertsPC.push_back(VertexPC(corners[3],color));      
    m_vertsPC.push_back(VertexPC(corners[7],color));      



}