Ejemplo n.º 1
0
void ModelEntity::updateLocation(const Point4& location)
{
	this->translateX = location.getX();
	this->translateY = location.getY();
	this->translateZ = location.getZ();

	updateMetrics();

	updateBoundingSphereCenter(true);
}
Ejemplo n.º 2
0
void ModelEntity::setPosition(const Point4& position)
{
	this->translateX = position.getX();
	this->translateY = position.getY();
	this->translateZ = position.getZ();

	this->position = position;

	updateMetrics();

	updateBoundingSphereCenter(true);
}
Ejemplo n.º 3
0
void ModelEntity::updateLocationOrientation(const Point4& location, const Quaternion& orientation)
{
	this->translateX = location.getX();
	this->translateY = location.getY();
	this->translateZ = location.getZ();
	this->rotation = orientation;

	this->updateNormalModelMatrix = true;

	updateMetrics();

	updateBoundingSphereCenter(true);
}
Ejemplo n.º 4
0
void DebugDraw::draw(const Plane& plane, const Point4& origin, const Color& color) const
{
	Matrix4x4 modelMatrix;

	if (!LineGeometryManager::getInstance()->getLineGeometry("GridPlane").get())
	{
		return;
	}

	float x = -plane.getPlane()[0] * plane.getPlane()[3] + origin.getX();
	float y = -plane.getPlane()[1] * plane.getPlane()[3] + origin.getY();
	float z = -plane.getPlane()[2] * plane.getPlane()[3] + origin.getZ();

	modelMatrix.identity();
	modelMatrix.translate(x, y, z);
	modelMatrix.rotateRzRyRx(0.0f, plane.getPlane()[0] * 90.0f, plane.getPlane()[1] * -90.0f);

	LineGeometryManager::getInstance()->getLineGeometry("GridPlane")->draw(modelMatrix, color);
}
Ejemplo n.º 5
0
void ModelEntity::setMetrics(const Point4& position, const Quaternion& rotation, float scaleX, float scaleY, float scaleZ)
{
	this->translateX = position.getX();
	this->translateY = position.getY();
	this->translateZ = position.getZ();

	this->position = position;

	this->rotation = rotation;

	this->scaleX = scaleX;
	this->scaleY = scaleY;
	this->scaleZ = scaleZ;

	this->updateNormalModelMatrix = true;

	updateMetrics();

	updateBoundingSphereCenter(true);
}
Ejemplo n.º 6
0
void Sky::render(const Point4& center) const
{
	Matrix4x4 translationMatrix;
	translationMatrix.translate(center.getX(), center.getY(), center.getZ());

    glFrontFace(GL_CW);

    if (skyTexture.get())
    {
    	glBindTexture(GL_TEXTURE_CUBE_MAP, skyTexture->getTextureName());
    }
    else
    {
    	glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
    }

	program->use();

	glUniformMatrix4fv(program->getUniformLocation(u_modelMatrix), 1, GL_FALSE, (translationMatrix * scaleMatrix).getM());

    glUniform1i(program->getUniformLocation(u_cubemap), 0);

	// Write bright color
	glUniform1i(program->getUniformLocation(u_writeBrightColor), writeBrightColor);
	glUniform1f(program->getUniformLocation(u_brightColorLimit), brightColorLimit);

	skyVAO->bind();

	glDrawElements(GL_TRIANGLES, numberIndices, GL_UNSIGNED_INT, 0);

	skyVAO->unbind();

	glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

    glFrontFace(GL_CCW);
}