Exemplo n.º 1
0
void SpriteBatch::DrawTexture(Texture2D* tex, float destX, float destY, float destW, float destH, float originX, float originY, float rotation, float scale)
{
    if(!_begun)
        cout << "SB hiba!" << endl;

    //Minden méretet HD fölbontásra adok meg és itt alakítom ezeket az aktuális fölbontásra
    destX = (destX / 1280) * _pong->GetGFX()->GetContextWidth();
    destY = (destY / 720) * _pong->GetGFX()->GetContextHeight();
    destW = (destW / 1280) * _pong->GetGFX()->GetContextWidth();
    destH = (destH / 720) * _pong->GetGFX()->GetContextHeight();

    originX = (originX / 1280) * _pong->GetGFX()->GetContextWidth();
    originY = (originY / 720) * _pong->GetGFX()->GetContextHeight();

    glm::mat4 w = CalculateWorld(destX, destY, destW, destH, originX, originY, rotation, scale);
    glm::mat4 mvp = _projMatrix * w;

    SpriteShader->SetMatrix(_mvpLocation, glm::value_ptr(mvp));
    SpriteShader->SetSampler(_textureLocation, 0, tex->GetID());

    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);
}
Exemplo n.º 2
0
Volume* Ray::CalculateWorld( const glm::mat4& world, const glm::vec3& position, const glm::quat& orientation, const float scale ) const
{
	Volume* worldVolume = pNew( Ray );
	CalculateWorld( world, position, orientation, scale, worldVolume );
	return worldVolume;
}
Exemplo n.º 3
0
Volume* HeightMap::CalculateWorld( const glm::mat4& world, const glm::vec3& position, const glm::quat& orientation, const float scale ) const
{
    Volume* worldVolume = pNew( HeightMap, this->HeightFunction );
	CalculateWorld( world, position, orientation, scale, worldVolume );
	return worldVolume;
}