示例#1
0
void Camera::SetupPerspective(float _fov, float _aspectRatio, float _near /* = 0.01f*/, float _far /* = 1000.0f*/)
{
    projectionTransform = glm::perspective(_fov, _aspectRatio, _near, _far);
    perspectiveSet = true;

    UpdateProjectionViewTransform();
}
示例#2
0
//setup functions
void Camera::LookAt(glm::vec3 _lookAt, glm::vec3 _up)
{
    glm::vec4 location = worldTransform[3]; //current position data saved because not passed in
    worldTransform = glm::inverse(glm::lookAt(location.xyz(), _lookAt, _up));

    UpdateProjectionViewTransform();
}
示例#3
0
		void FlyCamera::CalculateRotation( real64_t dt, real64_t xOffset, real64_t yOffset ) {
			glm::mat4 inversed = glm::inverse( worldTransform );
			glm::mat4 rot = glm::rotate( glm::radians( (float)-(xOffset * dt) ), inversed[1].xyz() );
			worldTransform = worldTransform * rot;

			rot = glm::rotate( glm::radians( (float)-(yOffset * dt) ), glm::vec3( 1, 0, 0 ) );
			worldTransform = worldTransform * rot;

			glm::mat4 trans = worldTransform;

			worldTransform[0].xyz() = glm::normalize( glm::cross( glm::vec3( 0, 1, 0 ), trans[2].xyz() ));
			worldTransform[0].w = 0.0;

			worldTransform[1].xyz() = glm::normalize( glm::cross( trans[2].xyz(), worldTransform[0].xyz() ) );
			worldTransform[1].w = 0.0;

			worldTransform[2].w = 0.0;

			UpdateProjectionViewTransform();
		}
示例#4
0
Camera::Camera(glm::mat4 _transform)
    : worldTransform(_transform) //initialisng world transform inline
{
    UpdateProjectionViewTransform();
}
示例#5
0
Camera::Camera(glm::vec3 _position) {
	m_worldTransform = glm::mat4(1);
	m_worldTransform[3] = glm::vec4(_position, 1);
	UpdateProjectionViewTransform();
}
示例#6
0
	BaseCamera::BaseCamera( const Renderer::View &view, const glm::mat4 &transform )
	:	view( view ),
		worldTransform( transform )
	{
		UpdateProjectionViewTransform();
	}
示例#7
0
void Camera::setPosition(vec3 position)
{
	worldTransform[3] = vec4(position, 1);
	UpdateProjectionViewTransform();
}
示例#8
0
void Camera::setOrthographic(float left, float right, float bottom, float top)
{
	projectionTransform = glm::ortho(left, right, bottom, top);
	UpdateProjectionViewTransform();
}
示例#9
0
Camera::Camera(glm::mat4 _transform) : m_worldTransform(_transform) {
	UpdateProjectionViewTransform();
}
示例#10
0
	void BaseCamera::SetupPerspective( real32_t fov, real32_t aspectRatio, real32_t zNear, real32_t zFar ) {
		projectionTransform = glm::perspective( fov, aspectRatio, zNear, zFar );
		perspectiveSet = true;

		UpdateProjectionViewTransform();
	}
示例#11
0
	void BaseCamera::LookAt( const glm::vec3 &position, const glm::vec3 &lookAt, const glm::vec3 &worldUp ) {
		worldTransform = glm::inverse( glm::lookAt( position, lookAt, worldUp ) );
		UpdateProjectionViewTransform();
	}
示例#12
0
	void BaseCamera::LookAt( const glm::vec3 &lookAt, const glm::vec3 &worldUp ) {
		glm::vec4 vLocation = worldTransform[3];
		worldTransform = glm::inverse( glm::lookAt( vLocation.xyz(), lookAt, worldUp ) );
		UpdateProjectionViewTransform();
	}
示例#13
0
	void BaseCamera::SetPosition( const glm::vec3 &position ) {
		worldTransform[3] = glm::vec4( position, 1.0f );
		UpdateProjectionViewTransform();
	}
示例#14
0
	void BaseCamera::SetTransform( const glm::mat4 &transform ) {
		worldTransform = transform;
		UpdateProjectionViewTransform();
	}
示例#15
0
void Camera::SetTransform(glm::mat4 _transform)
{
    worldTransform = _transform;
    UpdateProjectionViewTransform();
}
示例#16
0
void Camera::SetPosition(glm::vec3 _position)
{
    worldTransform[3] = glm::vec4(_position, 1);
    UpdateProjectionViewTransform();
}
示例#17
0
void Camera::SetLookAt(glm::vec3 _to, glm::vec3 _up) {
	glm::vec4 vLocation = m_worldTransform[3];
	m_worldTransform = glm::inverse(glm::lookAt(vLocation.xyz(), _to, _up));
	UpdateProjectionViewTransform();
}
示例#18
0
void Camera::LookAt(glm::vec3 _position, glm::vec3 _lookAt, glm::vec3 _up)
{
    worldTransform = glm::inverse(glm::lookAt(_position, _lookAt, _up)); //position data passed in

    UpdateProjectionViewTransform();
}
示例#19
0
Camera::Camera() {
	m_worldTransform = glm::mat4(1);
	UpdateProjectionViewTransform();
}
示例#20
0
void Camera::setPerspective(float FOV, float aspectRatio, float nearPlane, float farPlane)
{
	projectionTransform = glm::perspective(FOV, aspectRatio, nearPlane, farPlane);
	UpdateProjectionViewTransform();
}
示例#21
0
void Camera::SetLookAt(glm::vec3 _from, glm::vec3 _to, glm::vec3 _up) {
	m_worldTransform = glm::inverse(glm::lookAt(_from, _to, _up));
	UpdateProjectionViewTransform();
}
示例#22
0
void Camera::LookAt(vec3 position, vec3 target, vec3 worldUp)
{
	worldTransform = glm::inverse(glm::lookAt(position, target, worldUp));
	UpdateProjectionViewTransform();
}
示例#23
0
void Camera::SetPerspective(float _fieldOfView, float _aspectRation, float _near, float _far) {
	m_projectionTransform = glm::perspective(_fieldOfView, _aspectRation, _near, _far);
	UpdateProjectionViewTransform();
}
示例#24
0
void Camera::setWorldTransform(const glm::mat4& transform)
{
	worldTransform = transform;
	UpdateProjectionViewTransform();
}
示例#25
0
void Camera::Translate(glm::vec3 _translation) {
	glm::vec4 pos = m_worldTransform[3];
	m_worldTransform[3] = pos + glm::vec4(_translation, 0);
	UpdateProjectionViewTransform();
}