示例#1
0
void gameDraw(OPfloat dt)
{
	OPrenderClear(0.15, 0.15, 0.15);
	SkyDraw(&GAME_CAMERA);
	ShipBatchDraw(&GAME_CAMERA);
	ProjectileBatchDraw(&GAME_CAMERA);
	OPrenderPresent();
}
void GimbalLock::Render(OPfloat delta)
{
#if RUN_SECONDARY_WINDOW
	MainWindow->Bind();
#endif
	OPrenderClear(0, 0, 0);

	RenderMain(delta);

#if RUN_SECONDARY_WINDOW
	// If there's a secondary window, present the Main Window first
	// Otherwise we're rendering to the second window
	OPrenderPresent();
#endif

	RenderSecondary();
	OPrenderPresent();
}
void GimbalLock::RenderSecondary() {
#if RUN_SECONDARY_WINDOW
	SecondaryWindow->Bind();
#endif

#ifdef ADDON_imgui
	OPimguiNewFrame();
	{
		ImGui::Text("Gimbal Lock");
		ImGui::DragFloat3("Rotation", (float*)&rotation, 1.0f, -180, 180);
		//ImGui::DragFloat3("Camera", (float*)&scene.camera.pos, 0.25f, -10.0, 10.0f);
		if (ImGui::Button("Start")) {
			interpolateRotation = 1;
			rotationTime = 0;
			rotationTarget = OPvec3(90, 0, 90);
		}
		if (ImGui::Button("Show Grey")) {
			scene.Add(&ringGrey, &materialGrey);
		}
		if (ImGui::Button("Remove Grey")) {
			scene.index--;
		}
		ImGui::DragFloat("Rotation Grey", (float*)&rotationGrey, 1.0f, -180, 180);
		if (ImGui::Button("Interpolate")) {
			interpolateRotation = 1;
			rotationTime = 0;
			rotationTarget = OPvec3(180, 90, 180);
		}
	}
#endif

#if RUN_SECONDARY_WINDOW
	OPrenderClear(0.2, 0.2, 0.2);
#endif

#ifdef ADDON_imgui
	ImGui::Render();
#endif
}
void ExampleState::Render(OPfloat delta) {
	OPrenderClear(0, 0, 0, 1);
	OPrenderPresent();
}