Beispiel #1
0
void Context::uploadMesh(ocull::Mesh *pMesh, const ocull::Matrix4x4 &modelMatrix)
{
  assert( isQueryBounded() == true );
  assert( pMesh != NULL );
  
  
  /// Update simple stats
  Query::Result &result = m_pQuery->m_result; //
  result.objectCount += 1u;
  result.trianglePassedCount += pMesh->getTriangleCount();
    
  
  /// Resize the output vertices buffer
  size_t vertexSize = pMesh->vertex.count * sizeof(FW::ShadedVertex_passthrough);
  m_outVertices.resizeDiscard( vertexSize );  //
  
  // Vertex Shader
  runVertexShader( pMesh, modelMatrix);  
  
  
  // Pipeline
  m_rasterizer.setVertexBuffer( &m_outVertices, 0);
  m_rasterizer.setIndexBuffer( &(pMesh->index.buffer), 
                               pMesh->index.offset, 
                               pMesh->getTriangleCount());
  //m_rasterizer.setIndexBuffer_TEST( &pDevice, pMesh->getTriangleCount());
  
  m_rasterizer.drawTriangles();
}
Beispiel #2
0
void RendererServicePicking::execute()
{
    glUseProgram(m_program);
	
	glUniform2f(m_uniformSampledFragment, m_point.x, m_point.y);

	runVertexShader();	

    glUseProgram(0);
}
Beispiel #3
0
void RendererServiceAddVoxel::execute()
{
    glUseProgram(m_program);
	
	// m_screenFocal point origin is at top-left, whilst glsl is bottom-left
	glUniform2f(m_uniformScreenSpaceMotion,
				m_velocity.x , -m_velocity.y ); 

	runVertexShader();	

    glUseProgram(0);
}