예제 #1
0
파일: Render.cpp 프로젝트: DevO2012/PEEL
		virtual	void	Render(const PR& pose)
		{
			glPushMatrix();
			{
				SetupGLMatrix(pose);
//				glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
				glCallList(mDisplayListNum);
			}
			glPopMatrix();

			if(0 && mShadows)
			{
				glPushMatrix();
				{
					const static float shadowMat[]={ 1,0,0,0, 0,0,0,0, 0,0,1,0, 0,0,0,1 };
					glMultMatrixf(shadowMat);
	//				glMultMatrixf(glMat);
					SetupGLMatrix(pose);
					glDisable(GL_LIGHTING);
					glColor4f(0.1f, 0.2f, 0.3f, 1.0f);
					//glutSolidCube(float(size_t(actor->userData))*2.0f);
					glCallList(mDisplayListNum);
					glEnable(GL_LIGHTING);
				}
				glPopMatrix();
			}
		}
예제 #2
0
void DrawCapsule(NxShape* capsule, const NxVec3& color)
{
	NxMat34 pose = capsule->getGlobalPose();

	const NxReal & r = capsule->isCapsule()->getRadius();
	const NxReal & h = capsule->isCapsule()->getHeight();

	glPushMatrix();
	SetupGLMatrix(pose.t, pose.M);

	glPushMatrix();
	glTranslatef(0.0f, h*0.5f, 0.0f);
	glScalef(r,r,r);
	RenderSphere();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.0f,-h*0.5f, 0.0f);
	glScalef(r,r,r);
	RenderSphere();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(0.0f,h*0.5f, 0.0f);
	glScalef(r,h,r);
	glRotatef(90.0f,1.0f,0.0f,0.0f);
	RenderCylinder();
	glPopMatrix();

	glPopMatrix();
}
예제 #3
0
파일: Render.cpp 프로젝트: DevO2012/PEEL
void DrawBox(const Point& extents, const PR& pose)
{
//	return;
	glPushMatrix();
		SetupGLMatrix(pose);
		glScalef(extents.x, extents.y, extents.z);
		glutSolidCube(2.0f);
	glPopMatrix();
}
예제 #4
0
파일: Render.cpp 프로젝트: DevO2012/PEEL
void DrawSphere(float radius, const PR& pose)
{
//	return;
	glPushMatrix();
		SetupGLMatrix(pose);
		glScalef(radius, radius, radius);
		glutSolidSphere(1.0f, 12, 12);
	glPopMatrix();
}
예제 #5
0
void DrawSphere(NxShape* sphere, const NxVec3& color)
{
	NxMat34 pose = sphere->getGlobalPose();

	glPushMatrix();
	SetupGLMatrix(pose.t, pose.M);
	NxReal r = sphere->isSphere()->getRadius();
	glScalef(r,r,r);
	RenderSphere();
	glPopMatrix();
}
예제 #6
0
void DrawBox(NxShape* box, const NxVec3& color)
{
	NxMat34 pose = box->getGlobalPose();

	glPushMatrix();
	SetupGLMatrix(pose.t, pose.M);
	NxVec3 boxDim = box->isBox()->getDimensions();
	glScalef(boxDim.x, boxDim.y, boxDim.z);
	RenderBox(2.0);
	glPopMatrix();
}
예제 #7
0
파일: Render.cpp 프로젝트: DevO2012/PEEL
void DrawCapsule(float r, float h, const PR& pose)
{
/*	glPushMatrix();
		SetupGLMatrix(pose);

		unsigned num = 12;
		glRotatef(90.0f, 0.0f, 1.0f, 0.0f);
		gluSphere(GetGLUQuadric(), 
				  r, 
				  num, num);
		gluCylinder(GetGLUQuadric(), r, r, h, num, num);

		glTranslatef(0.0f, 0.0f, h);
		gluSphere(GetGLUQuadric(), 
				  r,
				  num, num);

	glPopMatrix();
	return;*/

	glPushMatrix();
		SetupGLMatrix(pose);

		glPushMatrix();
			glTranslatef(0.0f, h*0.5f, 0.0f);
			glScalef(r,r,r);
			glutSolidSphere(1.0f, 12, 12);  // doesn't include texcoords
		glPopMatrix();

		glPushMatrix();
			glTranslatef(0.0f,-h*0.5f, 0.0f);
			glScalef(r,r,r);
			glutSolidSphere(1.0f, 12, 12);  // doesn't include texcoords
		glPopMatrix();

		glPushMatrix();
			glTranslatef(0.0f,h*0.5f, 0.0f);
			glScalef(r,h,r);
			glRotatef(90.0f,1.0f,0.0f,0.0f);
			RenderCylinder();
		glPopMatrix();
	glPopMatrix();
}
예제 #8
0
void DrawPlane(NxShape* plane)
{
	NxPlaneShape* planeShape = plane->isPlane();
	NxPlane p = planeShape->getPlane();
	NxVec3 n=p.normal;
	n.normalize();
	NxVec3 t1;
	NxVec3 t2;
	static const NxReal cos45 = 0.7071067811865475244008443621048490;
	if (fabs(n.z) > cos45) 
	{
		NxReal a = n.y*n.y + n.z*n.z;
		NxReal k = NxReal(1.0)/NxMath::sqrt(a);
		t1.set(0,-n.z*k,n.y*k);
		t2.set(a*k,-n.x*t1.z,n.x*t1.y);
	}
	else 
	{
		NxReal a = n.x*n.x + n.y*n.y;
		NxReal k = NxReal(1.0)/NxMath::sqrt(a);
		t1.set(-n.y*k,n.x*k,0);
		t2.set(-n.z*t1.y,n.z*t1.x,a*k);
	}
	NxMat34 pose;
	pose.M.setColumn(0, t2);
	pose.M.setColumn(1, n);
	pose.M.setColumn(2, t1);
	// We can't use this cause someone decided it was a good idea to support two plane representations
	// pose.t=p.pointInPlane();
	pose.t = n * p.d;
	glPushMatrix();
	glDisable(GL_LIGHTING);
	glColor4f(0.1f, 0.2f, 0.3f, 1.0f);
	SetupGLMatrix(pose.t, pose.M);
	glTranslatef(0,-0.1f,0);
	glScalef(1024,1,1024);
	RenderPlane();
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	glEnable(GL_LIGHTING);
	glPopMatrix();
}