当前位置: 首页>>代码示例>>C++>>正文


C++ MatrixTransform::set方法代码示例

本文整理汇总了C++中MatrixTransform::set方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixTransform::set方法的具体用法?C++ MatrixTransform::set怎么用?C++ MatrixTransform::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MatrixTransform的用法示例。


在下文中一共展示了MatrixTransform::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: idleCallback

//----------------------------------------------------------------------------
// Callback method called when system is idle.
void Window::idleCallback()
{
	Matrix4 transform;
	Matrix4 temp;
	Matrix4 reverseTemp;
	temp = leftArmRotation.get();
	reverseTemp = temp;
	if (walk) {
		if (forw) {
			temp.makeRotateX(degree);
			reverseTemp.makeRotateX(-degree);
			degree++;
			if (degree == 20)
				forw = !forw;
		}
		else {
			temp.makeRotateX(degree);
			reverseTemp.makeRotateX(-degree);
			std::cout << "ASD" << std::endl;
			degree--;
			if (degree == -20)
				forw = !forw;
		}
	}
	else {
		degree = 0;
		temp.identity();
		reverseTemp.identity();
	}
	transform.makeTranslate(0, -1.5, 0);
	temp = temp * transform;
	reverseTemp = reverseTemp * transform;
	transform.makeTranslate(0, 1.5, 0);
	temp = transform * temp;
	reverseTemp = transform * reverseTemp;
	leftArmRotation.set(temp);
	rightLegRotation.set(temp);
	rightArmRotation.set(reverseTemp);
	leftLegRotation.set(reverseTemp);
    displayCallback();         // call display routine to show the object
}
开发者ID:twluo,项目名称:MazeRunner,代码行数:43,代码来源:window.cpp

示例2: displayCallback

//----------------------------------------------------------------------------
// Callback method called by GLUT when window readraw is necessary or when glutPostRedisplay() was called.
void Window::displayCallback()
{

	glEnable(GL_LIGHT0);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  // clear color and depth buffers
	glColor3f(0, 0, 1);
	//Setting moving camera
	Matrix4 glmatrix;
	if (cam) {
		if (t == 99) {
			back = true;
		}
		if (t == 0)
			back = false;
		Vector3 upd = belzCamera.upd;
		belzCamera.set(points[t], Vector3(0,0,0), upd);
		std::cout << t << std::endl;
	}
	if (altCam) {
		glmatrix = belzCamera.getInverse();
	}
	else {
		glmatrix = camera.getInverse();
	}
	//Drawing Light Source

	Matrix4 temp;
	temp.makeTranslate(position[0], position[1], position[2]);
	setMatrix(glmatrix, temp);
	glColor3f(1, 1, 0);
	glutSolidSphere(.5, 100, 100);
	setMatrix(glmatrix);
	glLightfv(GL_LIGHT0, GL_POSITION, position);
	//glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);

	/*
	//Seting main objects
	glColor3d(1, 0, 0);
	setMatrix(glmatrix, object.getMatrix());
	glutSolidCube(2);
	temp.makeTranslate(3, 1.5, 0);
	setMatrix(glmatrix, temp);
	glColor3d(1, 0, 1);
	glutSolidCube(3); 
	temp.makeTranslate(0, 1.5, 3);
	setMatrix(glmatrix, temp);
	glColor3d(0, 1, 1);
	glutSolidCube(3);
	temp.makeTranslate(0, 1.5, -3);
	setMatrix(glmatrix, temp);
	glColor3d(1, 1, 0);
	glutSolidCube(3);
	temp.makeTranslate(-3, 1.5, 0);
	setMatrix(glmatrix, temp);
	glColor3d(1, 1, 1);
	glutSolidCube(3);

	//Setting Floor
	setMatrix(glmatrix);
	glBegin(GL_QUADS);
	glNormal3d(0, 1, 0);
	glColor3d(0.5, 0.6, 0.7);
	glVertex3d(-10, 0, -10);
	glVertex3d(-10, 0, 10);
	glVertex3d(10, 0, 10);
	glVertex3d(10, 0, -10);
	glEnd();*/
	setMatrix(glmatrix);	
	if (light) {
		Globals::shader->bind();
	}
	else
		Globals::shader->unbind();
	glutSolidTeapot(5);
	plane.animate();
	plane.draw();
	Globals::shader->unbind();
	//Drawing Bezier Curve
	glBegin(GL_LINE_STRIP);
	for (int i = 0; i < 99; i++) {
		Vector3 current = points[i];
		Vector3 next = points[i + 1];
		glLineWidth(2.5);
		glColor3f(1.0, 1.0, 0.0);
		glVertex3d(current.getX(), current.getY(), current.getZ());
		glVertex3d(next.getX(), next.getY(), next.getZ());
	}
	glEnd();

	//Drawing Head
	glActiveTexture(GL_TEXTURE0);
	temp = glmatrix;
	control.set(person.getMatrix());
	character.draw(temp, light);
	
	//Drawing Camera
	setMatrix(glmatrix, cameraObject.getMatrix());
	glColor3f(0, 1, 1);
//.........这里部分代码省略.........
开发者ID:twluo,项目名称:MazeRunner,代码行数:101,代码来源:window.cpp


注:本文中的MatrixTransform::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。