Пример #1
0
void Camera::moveSideward(float length) {
	vec4 posVec = vec4(length, 0.0f, 0.0f, 0.0f) * this->getViewRotateXY();

	posX += posVec.x;
	posY += posVec.y;
	posZ += posVec.z;

	recalcView();
}
Пример #2
0
void mouse (int32_t button, int32_t state, int32_t x, int32_t y) {
    switch (button) {
        case GLUT_LEFT_BUTTON:
			rightMouse=0;
            switch (state) {
				case GLUT_DOWN:
					selectZoomX = x;
					selectZoomY = y;
					break;
				case GLUT_UP:
					selectZoomW = x;
					selectZoomH = y;
					mousePosX = 0;
					mousePosY = 0;
					recalcZoom();
					break;
			}
            break;
			
        case GLUT_RIGHT_BUTTON:
			rightMouse=1;
            switch (state) {
				case GLUT_DOWN:
					selectMoveX = x;
					selectMoveY = y;
					break;
				case GLUT_UP:
					selectMoveW = x;
					selectMoveH = y;
					mousePosX = 0;
					mousePosY = 0;
					recalcView();
					break;
			}
            break;
    }
}
Пример #3
0
void Camera::setPos(float x, float y, float z) {
	this->posX = x;
	this->posY = y;
	this->posZ = z;
	recalcView();
}
Пример #4
0
void Camera::setPosZ(float z) {
	this->posZ = z;
	recalcView();
}
Пример #5
0
void Camera::setPosY(float y) {
	this->posY = y;
	recalcView();
}
Пример #6
0
void Camera::setPosX(float x) {
	this->posX = x;
	recalcView();
}
Пример #7
0
float Camera::setTheta(float theta)
{
	m_theta = theta;
	recalcView();
	return m_theta;
}
Пример #8
0
float Camera::setPhi(float phi)
{
	m_phi = glm::clamp(phi, (float)-M_PI_2, (float)M_PI_2);
	recalcView();
	return m_phi;
}