Exemple #1
0
void SampleSubmarine::customizeRender()
{
	SampleRenderer::Renderer* renderer = getRenderer();
	const PxU32 yInc = 18;
	const RendererColor textColor(255, 255, 255, 255);

	PxU32 width, height;
	renderer->getWindowSize(width, height);
	char healthBar[20];
	PxU32 h = gSubmarineHealth;
	sprintf(healthBar, "Health:%c%c%c%c%c%c%c%c%c%c", (h>90?'I':' '), (h>80?'I':' '), (h>70?'I':' '),(h>60?'I':' '),(h>50?'I':' '), 
	(h>40?'I':' '), (h>30?'I':' '), (h>20?'I':' '),(h>10?'I':' '),(h>0?'I':' '));
	renderer->print(width-130, height-yInc, healthBar);	
	if(gTreasureFound)
		renderer->print(width-160, height-2*yInc, "Treasure Found!");	
}
Exemple #2
0
void SampleParticles::customizeRender()
{
	SampleRenderer::Renderer* renderer = getRenderer();

	// render the sight
	SampleRenderer::RendererColor sightColor(200, 40, 40, 127);
	PxReal sight[] = {  0.47f, 0.50f, 0.49f, 0.50f,	// line 1
						0.51f, 0.50f, 0.53f, 0.50f,	// line 2
						0.50f, 0.47f, 0.50f, 0.49f,	// line 3
						0.50f, 0.51f, 0.50f, 0.53f	// line 4
					 };

	renderer->drawLines2D(2, sight, sightColor);
	renderer->drawLines2D(2, sight + 4, sightColor);
	renderer->drawLines2D(2, sight + 8, sightColor);
	renderer->drawLines2D(2, sight + 12, sightColor);

	//settings for right lower corner info text (same hight as fps display)
	const PxU32 yInc = 18;
	const PxReal scale = 0.5f;
	const PxReal shadowOffset = 6.0f;
	PxU32 width, height;
	renderer->getWindowSize(width, height);

	PxU32 y = height-2*yInc;
	PxU32 x = width - 240;

	if (mLoadTextAlpha > 0)
	{
		const RendererColor textColor(255, 0, 0, PxU8(mLoadTextAlpha*255.0f));
		const char* message[3] = { "Particle count: Moderate", "Particle count: Medium", "Particle count: High" };
		renderer->print(x, y, message[mParticleLoadIndex], scale, shadowOffset, textColor);
		y -= yInc;
	}

#if PX_SUPPORT_GPU_PHYSX
	{
		const RendererColor textColor(255, 0, 0, 255);
		renderer->print(x, y, mRunOnGpu ? "Running on GPU" : "Running on CPU", scale, shadowOffset, textColor);
	}
#endif
}
Exemple #3
0
void SampleParticles::helpRender(PxU32 x, PxU32 y, PxU8 textAlpha)
{
	SampleRenderer::Renderer* renderer = getRenderer();
	const PxU32 yInc = 18;
	const PxReal scale = 0.5f;
	const PxReal shadowOffset = 6.0f;
	const RendererColor textColor(255, 255, 255, textAlpha);
	const bool isMouseSupported = getApplication().getPlatform()->getSampleUserInput()->mouseSupported();
	const bool isPadSupported = getApplication().getPlatform()->getSampleUserInput()->gamepadSupported();
	const char* msg;

	if (isMouseSupported && isPadSupported)
		renderer->print(x, y += yInc, "Use mouse or right stick to rotate", scale, shadowOffset, textColor);
	else if (isMouseSupported)
		renderer->print(x, y += yInc, "Use mouse to rotate", scale, shadowOffset, textColor);
	else if (isPadSupported)
		renderer->print(x, y += yInc, "Use right stick to rotate", scale, shadowOffset, textColor);
	if (isPadSupported)
		renderer->print(x, y += yInc, "Use left stick to move",scale, shadowOffset, textColor);
	msg = mApplication.inputMoveInfoMsg("Press "," to move", CAMERA_MOVE_FORWARD,CAMERA_MOVE_BACKWARD, CAMERA_MOVE_LEFT, CAMERA_MOVE_RIGHT);
	if(msg)
		renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
	msg = mApplication.inputInfoMsg("Press "," to move fast", CAMERA_SHIFT_SPEED, -1);
	if(msg)
		renderer->print(x, y += yInc, msg, scale, shadowOffset, textColor);
	msg = mApplication.inputInfoMsg("Press "," to shoot raygun", RAYGUN_SHOT, -1);
	if(msg)	
		renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
	msg = mApplication.inputInfoMsg("Press "," to toggle various debug visualization", TOGGLE_VISUALIZATION, -1);
	if(msg)
		renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
	msg = mApplication.inputInfoMsg("Press "," to change particle count", CHANGE_PARTICLE_CONTENT,-1);
	if(msg)
		renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);

#if defined(PX_WINDOWS)
	msg = mApplication.inputInfoMsg("Press "," to toggle CPU/GPU", TOGGLE_CPU_GPU, -1);
	if(msg)
		renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
#endif

}
void SampleCharacterCloth::customizeRender()
{
#if PX_SUPPORT_GPU_PHYSX
	SampleRenderer::Renderer* renderer = getRenderer();

	const PxU32 yInc = 18;
	const PxReal scale = 0.5f;
	const PxReal shadowOffset = 6.0f;
	PxU32 width, height;
	renderer->getWindowSize(width, height);

	PxU32 y = height-2*yInc;
	PxU32 x = width - 240;

	{
		const RendererColor textColor(255, 0, 0, 255);
		renderer->print(x, y, mUseGPU ? "Running on GPU" : "Running on CPU", scale, shadowOffset, textColor);
	}
#endif

}
Exemple #5
0
void SampleSubmarine::helpRender(PxU32 x, PxU32 y, PxU8 textAlpha)
{
	SampleRenderer::Renderer* renderer = getRenderer();
	const PxU32 yInc = 18;
	const PxReal scale = 0.5f;
	const PxReal shadowOffset = 6.0f;
	const RendererColor textColor(255, 255, 255, textAlpha);
	const bool isMouseSupported = getApplication().getPlatform()->getSampleUserInput()->mouseSupported();
	const bool isPadSupported = getApplication().getPlatform()->getSampleUserInput()->gamepadSupported();
	const char* msg;

	msg = mApplication.inputInfoMsg("Press "," to toggle various debug visualization", TOGGLE_VISUALIZATION, -1);
	if(msg)
		renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
	msg = mApplication.inputInfoMsg("Press "," to restart", SCENE_RESET,-1);
	if(msg)
		renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
	if (isMouseSupported && isPadSupported)
		renderer->print(x, y += yInc, "Use mouse or right stick to rotate the camera", scale, shadowOffset, textColor);
	else if (isMouseSupported)
		renderer->print(x, y += yInc, "Use mouse to rotate the camera", scale, shadowOffset, textColor);
	else if (isPadSupported)
		renderer->print(x, y += yInc, "Use right stick to rotate the camera", scale, shadowOffset, textColor);
	msg = mApplication.inputInfoMsg("Press "," to switch between submarine/crab/flyCam", CAMERA_SWITCH, -1);
	if(msg)
		renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);

	if(mCameraAttachedToActor == mSubmarineActor)
	{
		renderer->print(x, y += yInc, "Submarine Controller:", scale, shadowOffset, textColor);
		const char* msg = mApplication.inputInfoMsg("Press "," to move along view direction", SUBMARINE_FORWARD, SUBMARINE_BACKWARD);
		if(msg)
			renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
		msg = mApplication.inputInfoMsg("Press "," to raise and dive", SUBMARINE_UP, SUBMARINE_DOWN);
		if(msg)
			renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
	}
	else if(gCrab && (mCameraAttachedToActor == gCrab->getCrabBody()))
	{
		renderer->print(x, y += yInc, "Crab Controller:", scale, shadowOffset, textColor);
		if (isPadSupported)
			renderer->print(x, y += yInc, "Use left stick to move the crab", scale, shadowOffset, textColor);
		const char* msg = mApplication.inputMoveInfoMsg("Press "," to move the crab", CRAB_FORWARD, CRAB_BACKWARD, CRAB_LEFT, CRAB_RIGHT);
		if(msg)
			renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
	}
	else
	{
		renderer->print(x, y += yInc, "Fly Cam Controller:", scale, shadowOffset, textColor);
		if (isPadSupported)
			renderer->print(x, y += yInc, "Use left stick to move",scale, shadowOffset, textColor);
		const char* msg = mApplication.inputMoveInfoMsg("Press ","  to move", CAMERA_MOVE_FORWARD,CAMERA_MOVE_BACKWARD, CAMERA_MOVE_LEFT, CAMERA_MOVE_RIGHT);
		if(msg)
			renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
		msg = mApplication.inputInfoMsg("Press "," to move fast", CAMERA_SHIFT_SPEED, -1);
		if(msg)
			renderer->print(x, y += yInc, msg, scale, shadowOffset, textColor);
	}
}