本文整理汇总了C++中RotateY函数的典型用法代码示例。如果您正苦于以下问题:C++ RotateY函数的具体用法?C++ RotateY怎么用?C++ RotateY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RotateY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawBee
void drawBee() {
mvstack.push(model_view);
//rotate bee
model_view *= RotateY(-10*TIME);
model_view *= Translate(0, 5, 0);
model_view *= Translate(5, .5*sin(100+TIME), 0);
model_view *= RotateY(90);
//draw bee parts
drawBody();
drawHead();
drawTail();
drawWings();
drawLegz();
model_view = mvstack.pop();
}
示例2: display
void display( void )
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /*clear the window */
ctm = RotateX(theta[0])*RotateY(theta[1])*RotateZ(theta[2]);
glUniformMatrix4fv(ctm_loc, 1, GL_TRUE, ctm);
glDrawArrays(GL_TRIANGLES, 0, N);
glutSwapBuffers();
}
示例3: vec2
void Camera::Input()
{
float sensitivity = 0.001f;
float movAmt = static_cast<float>(10 * Time::GetDelta());
float rotAmt = static_cast<float>(1.5f * Time::GetDelta());
if (Input::GetMouseDown(GLFW_MOUSE_BUTTON_1))
{
m_cursorStoredPos = Input::GetCursorPosition();
vec2 centerPos = vec2((float)WIDTH / 2.0f, (float)WIDTH / 2.0f);
Input::SetCursorPosition(centerPos);
Input::SetCursorVisibility(false);
m_mouselocked = true;
}
if (Input::GetMouseUp(GLFW_MOUSE_BUTTON_1))
{
Input::SetCursorPosition(m_cursorStoredPos);
Input::SetCursorVisibility(true);
m_mouselocked = false;
}
if (m_mouselocked)
{
vec2 centerPos = vec2((float)WIDTH / 2.0f, (float)WIDTH / 2.0f);
vec2 currentPos = Input::GetCursorPosition();
vec2 deltaPos = centerPos - currentPos;
bool rotY = deltaPos.x != 0;
bool rotX = deltaPos.y != 0;
if (rotY)
RotateY(deltaPos.x * sensitivity);
if (rotX)
RotateX(deltaPos.y * sensitivity);
if (rotY || rotX)
Input::SetCursorPosition(centerPos);
}
if (Input::GetKey(GLFW_KEY_W))
{
MoveUp(movAmt);
}
if (Input::GetKey(GLFW_KEY_S))
{
MoveUp(-movAmt);
}
if (Input::GetKey(GLFW_KEY_D))
{
MoveRight(movAmt);
}
if (Input::GetKey(GLFW_KEY_A))
{
MoveRight(-movAmt);
}
}
示例4: SetCamType
void XM_CALLCONV Camera::Update( float deltaTime ) {
if( GetAsyncKeyState( VK_HOME ) ) {
SetCamType();
}
if( GetCamType()==1 ) {
if( GetAsyncKeyState( VK_LEFT ) ) {
RotateY( 5.0f * deltaTime );
}
if( GetAsyncKeyState( VK_RIGHT ) ) {
RotateY( -5.0f * deltaTime );
}
if( GetAsyncKeyState( VK_UP ) ) {
Walk( -15.0f * deltaTime );
}
if( GetAsyncKeyState( VK_DOWN ) ) {
Walk( 15.0f * deltaTime );
}
if( GetAsyncKeyState( VK_PRIOR ) ) {
Pitch( 1.0f * deltaTime );
}
if( GetAsyncKeyState( VK_NEXT ) ) {
Pitch( -1.0f * deltaTime );
}
if( GetAsyncKeyState( VK_OEM_COMMA ) ) {
Strafe( -15.0f * deltaTime );
}
if( GetAsyncKeyState( VK_OEM_PERIOD ) ) {
Strafe( 15.0f * deltaTime );
}
} else {
// default camera
//XMStoreFloat3( &target1, goblin1Pos);
//XMVECTOR posV = XMLoadFloat3( &pos );
//XMVECTOR targetV = goblin1Pos;
//XMVECTOR upV = GetUpXM();
//LookAt( posV, targetV, upV );
}
UpdateViewMatrix();
}
示例5: RotateX
void Quad::update(float dt)
{
Matrix rotXM, rotYM, rotZM, transM;
RotateX(&rotXM, rotX);
RotateY(&rotYM, rotY);
RotateZ(&rotZM, rotZ);
Translate(&transM, position.x, position.y, position.z);
world = rotXM * rotYM * rotZM * transM;
}
示例6: RotateY
void GLWidget::DoRotate(QPoint desc, QPoint orig)
{
//TODO: adjust the camera position so the viewport is rotated
double YRot = (desc.x() - orig.x()) * RadPerPixel;
double ZRot = -1 * (desc.y() - orig.y()) * RadPerPixel;
RotateY(&CameraPos, YRot);
RotateZ(&CameraPos, ZRot);
}
示例7: drawLeaf
void drawLeaf(void)
{
mvstack.push(model_view);
set_colour(0.4f, 1.0f, 0.4f);
model_view *= Scale(1.0f, 0.1f, 0.5f);
model_view *= RotateY(45);
drawCube();
model_view = mvstack.pop();
}
示例8: inithouseNode
Node* inithouseNode(int w, int h, int l)
{
Node *head = new Node[11];
//-------------
//memory manage
head->gar=garb;
garb=head;
//-------------
mat4 m(1.0f);
m = Scale(w,l,h);
head[0] = Node(m, blank,NULL,&head[1]);
m = Translate(1.5, -0.5, 0.0)*RotateY(-90.0);
head[1] = Node( m, rectangleY, &head[2], NULL);
m = Translate( 0.0, -0.5, 0.0)*RotateY(-90.0);
head[2] = Node( m, rectangleY, &head[3], NULL);
m = Translate(0.0, -0.5, 0.0)*RotateX(90.0)*Scale(1.5,1,1);
head[3] = Node( m, rectangleY, &head[4], NULL);
m = Translate(0.0, 0.5, 0.0)*RotateX(90.0)*Scale(1.5,1,1);
head[4] = Node( m, rectangleY, &head[5], NULL);
m = Translate(0.0, 0.0, 0.0);
head[5] = Node( m, blank, NULL, &head[6]);
m = Translate( 0.0, 0.0, 1.0)*RotateY(-90.0);
head[6] = Node( m, triangle, &head[7], NULL);
m = Translate( 1.5, 0.0, 1.0)*RotateY(-90.0);
head[7] = Node( m, triangle, &head[8], NULL);
m = Translate(0.0, -0.5, 1.0)*RotateX(45)*Scale(1.5, sqrt(0.5), 1.0);
head[8] = Node( m, rectangleM, &head[9], NULL);
m = Translate(0.0, 0.5, 1.0)*RotateX(135)*Scale(1.5, sqrt(0.5), 1.0);
head[9] = Node( m, rectangleM, NULL, NULL);
return &head[0];
}
示例9: Translate
//draws the body of the O
//@pre mv has been assigned
//@post draws an O to the world
//@param mv - the model view
//@usage drawBody(some_model_view)
void
Letter_O::drawBody(mat4& mv)
{
mvMatrixStack.pushMatrix(mv);
mv = mv * Translate(0.7, -0.5, 0);
mv = mv * Scale(1.5, 1.25, 1);
mvMatrixStack.pushMatrix(mv);
mv = mv * Translate(-2, 0, 0);
for (int i = 0; i < 5; i++) {
mvMatrixStack.pushMatrix(mv);
mv = mv * Translate(-1 + pow(i / 2.5, 2.0), i +6, 0);
vec4 color(0, 0, 1, 1);
mv = mv*Scale(cHeight,cLength,cWidth);
glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );
shapes.drawCube(color);
mv = mvMatrixStack.popMatrix();
}
for (int i = 0; i < 5; i++) {
mvMatrixStack.pushMatrix(mv);
mv = mv * RotateX(180);
mv = mv * Translate(-1 + pow(i / 2.5, 2.0), i - 5, 0);
vec4 color(0, 0, 1, 1);
mv = mv*Scale(cHeight,cLength,cWidth);
glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );
shapes.drawCube(color);
mv = mvMatrixStack.popMatrix();
}
mvMatrixStack.popMatrix();
mvMatrixStack.pushMatrix(mv);
mv = mv * Translate(3, 0, 0);
mv = mv * RotateY(180);
for (int i = 0; i < 5; i++) {
mvMatrixStack.pushMatrix(mv);
mv = mv * Translate(-1 + pow(i / 2.5, 2.0), i +6, 0);
vec4 color(0, 0, 1, 1);
mv = mv*Scale(cHeight,cLength,cWidth);
glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );
shapes.drawCube(color);
mv = mvMatrixStack.popMatrix();
}
for (int i = 0; i < 5; i++) {
mvMatrixStack.pushMatrix(mv);
mv = mv * RotateX(180);
mv = mv * Translate(-1 + pow(i / 2.5, 2.0), i - 5, 0);
vec4 color(0, 0, 1, 1);
mv = mv*Scale(cHeight,cLength,cWidth);
glUniformMatrix4fv( model_view, 1, GL_TRUE, mv );
shapes.drawCube(color);
mv = mvMatrixStack.popMatrix();
}
mvMatrixStack.popMatrix();
mvMatrixStack.popMatrix();
}
示例10: Rotate
MALIB_API MAT4x4 Rotate(float x, float y, float z)
{
MAT4x4 m;
if (x != 0.0f) m *= RotateX(x);
if (y != 0.0f) m *= RotateY(y);
if (z != 0.0f) m *= RotateZ(z);
return m;
}
示例11: vec4
/* This function will update the model view matrix
and send it to the GPU.. now geometry object
will rotate */
void Geometry::rotate(vec4 dir){
if(length(dir) == 0)
return;
float theta_x = dTheta * dir.x;
float theta_y = dTheta * -dir.y;
float theta_z = dTheta * -dir.z;
vec4 dthetas = vec4(theta_x, theta_y, theta_z, 0);
constrict_angles();
vec4 look = eye - at;
look = vec4(look.x, look.y, look.z, 0);
vec4 side = -cross( normalize(look), up);
mat4 M = mat4( normalize(side),
normalize(up),
normalize(look),
vec4(0,0,0,0) ); //x y z w
/* M is the basis matrix for the camera...
M^-1 == transpose(M) */
mat4 CameraToStandardBasis_M = transpose(M);
/* --- calculated by some change in theta/angle --- */
vec4 thetas_prime = CameraToStandardBasis_M * dthetas;
// YAW & PITCH (translate because at is not a vector.. its a point)
at = Translate(eye.x, eye.y, eye.z) *
RotateX(thetas_prime.x) *
RotateY(thetas_prime.y) *
RotateZ(thetas_prime.z) *
Translate(-eye.x, -eye.y, -eye.z) * at;
// PITCH & ROLL (luckily up is a vector..)
look = eye - at;
up = RotateX(thetas_prime.x) *
RotateY(thetas_prime.y) *
RotateZ(thetas_prime.z) * up;
}
示例12: getCurrentRotation
mat4 getCurrentRotation()
{
return mat4();
// rotate around the current axis
mat4 rotation;
if (currentAxis == XAxis) rotation = RotateX(degrees);
else if (currentAxis == YAxis) rotation = RotateY(degrees);
else rotation = RotateZ(degrees);
return rotation;
}
示例13: fprintf
// rotire fata de centru, aflat in fata la o distanta data
void Camera::RotateYCenter (GLfloat angle, float distance)
{
if(type!=CameraTypeORBIT)
{
fprintf(stderr, "Rotatie fata de un centru nepermisa. Tipul curent al camerei: %d\n",type);
return ;
}
MoveForward(distance);
RotateY(angle);
MoveBackward(distance);
}
示例14: RotateY
void cCamera::Update(bool keys[],int mouseX,int mouseY, object *plane)
{
float angle;
float alfa;
Map = plane;
if(mouseX!=middleX)
{
angle = (middleX - mouseX) / 50.0f;
RotateY(angle);
}
if(mouseY!=middleY)
{
angle = (middleY - mouseY) / 50.0f;
RotateX(angle);
}
if (keys['w']) MoveForwards(-speed);
if (keys['s']) MoveForwards(speed);
if (keys['a']) StrafeRight(-speed);
if (keys['d']) StrafeRight(speed);
if (keys[' ']) Jump();
// JUMP & GRAVITY
if (jumping)
{
jump_alfa += JUMP_STEP;
if (jump_alfa == 180)
{
jumping = false;
Position.y = jump_y;
}
else
{
alfa = ((float)jump_alfa) * 0.017453f;
Position.y = jump_y + (int)(((float)JUMP_HEIGHT) * sin(alfa));
if (jump_alfa > 90)
{
//Over floor?
jumping = !CollidesMap(GetCollider(), Map);
}
}
}
else
{
//Over floor?
if (!CollidesMap(GetCollider(), Map))
Position.y -= (2 * speed);
}
}
示例15: display
void display( void )
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /*clear the window */
ctm = RotateX(theta[0])*RotateY(theta[1])*RotateZ(theta[2]);
colorcube();
glBufferSubData( GL_ARRAY_BUFFER, 0, sizeof(points), points );
glBufferSubData( GL_ARRAY_BUFFER, sizeof(points), sizeof(quad_color), quad_color );
glDrawArrays(GL_TRIANGLES, 0, NumVertices);
glutSwapBuffers();
}