Ejemplo n.º 1
0
void Material::Render(Model* modelObj, Transform* transform, Matrix& projectionMatrix, Matrix& viewMatrix)
{
	if(modelObj != NULL)
	{
		ApplyShader();

		ApplyAttributes(modelObj);
		ApplyUniforms(transform, projectionMatrix, viewMatrix);
		ApplyTextures();
		
		glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, modelObj->mElementBuffer);
		int size; glGetBufferParameteriv(GL_ELEMENT_ARRAY_BUFFER, GL_BUFFER_SIZE, &size);
		glDrawElements(GL_TRIANGLES, size/sizeof(GLushort), GL_UNSIGNED_SHORT, 0);
	
		DisableAttributes();
	}
}
Ejemplo n.º 2
0
bool Node::Load(Deserializer& source)
{
    SceneResolver resolver;
    
    // Read own ID. Will not be applied, only stored for resolving possible references
    unsigned nodeID = source.ReadInt();
    resolver.AddNode(nodeID, this);
    
    // Read attributes, components and child nodes
    bool success = Load(source, resolver);
    if (success)
    {
        resolver.Resolve();
        ApplyAttributes();
    }
    
    return success;
}