void BoundsVisualiser::Draw(const Eegeo::v3& minExtents, const Eegeo::v3& maxExtents)
 {
     Build(minExtents, maxExtents);
     
     Eegeo_GL(glUseProgram(m_pShader->m_programHandle));
     
     Eegeo::m44 mvp;
     Eegeo::m44 w;
     w.Identity();
     Eegeo::m44::Mul(mvp, renderContext.GetViewProjectionMatrix(), w);
     
     Eegeo_GL(glUniformMatrix4fv(m_pShader->m_mvpUniform, 1, 0, (const GLfloat*)&mvp));
     
     Eegeo_GL(glEnableVertexAttribArray(m_pShader->m_positionSlot));
     
     Eegeo_GL(glBindBuffer(GL_ARRAY_BUFFER, m_glVertexBuffer));
     Eegeo_GL(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_glIndexBuffer));
     
     Eegeo_GL(glVertexAttribPointer(m_pShader->m_positionSlot, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0));
     
     for(u32 j = 0; j < NumIndices; j+=3)
     {
         Eegeo_GL(glDrawElements(GL_LINE_LOOP, 3, GL_UNSIGNED_SHORT, (void*)(j * 2)));
     }
     
     Eegeo_GL(glBindBuffer (GL_ARRAY_BUFFER, 0));
     Eegeo_GL(glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, 0));
     
     DestroyGeometry();
 }
Exemplo n.º 2
0
//
// Builds (or rebuilds) the geometry for a route.
//
void vtRoute::BuildGeometry(vtHeightField3d *pHeightField)
{
	if (!m_bDirty)
		return;

	if (m_bBuilt)
		DestroyGeometry();

	// create surface and shape
	_AddRouteMeshes(pHeightField);

	m_bBuilt = true;
	m_bDirty = false;
}
Exemplo n.º 3
0
/**
 * Build (or rebuild) the geometry for a fence.
 */
bool vtFence3d::CreateNode(vtTerrain *pTerr)
{
	bool bHighlighted = (m_pHighlightMesh != NULL);
	if (m_bBuilt)
	{
		// was build before; destroy meshes in order to re-build
		DestroyGeometry();
	}
	else
	{
		m_pFenceGeom = new vtGeode;
		m_pFenceGeom->setName("Fence");
		m_pFenceGeom->SetMaterials(GetSharedMaterialArray());
	}

	// create surface and shape
	AddFenceMeshes(pTerr->GetHeightField());

	if (bHighlighted)
		ShowBounds(true);

	m_bBuilt = true;
	return true;
}
Exemplo n.º 4
0
void vtFence3d::DeleteNode()
{
	DestroyGeometry();
	m_pFenceGeom = NULL;
}