예제 #1
0
//-----------------------------------------------------------------------------
//    ___      _ _   _      _ _         _   _          
//   |_ _|_ _ (_) |_(_)__ _| (_)_____ _| |_(_)___ _ _  
//    | || ' \| |  _| / _` | | |_ / _` |  _| / _ \ ' \ 
//   |___|_||_|_|\__|_\__,_|_|_/__\__,_|\__|_\___/_||_|
//               
void SkyInit()
{
	OPcmanLoad("skySphere.opm");
	OPcmanLoad("skySphere.png");
	
	// assign proxy variables to their assets in the content manager
	SKY_MESH     = (OPmesh*)OPcmanGet("skySphere.opm");
	SKY_COLORMAP = (OPtexture*)OPcmanGet("skySphere.png");
}
void GimbalLock::Init()
{
	scene.Init(16);

	arrow.Init("person.opm");
	ringX.Init("ring.opm");
	ringY.Init("ring.opm");
	ringZ.Init("ring.opm");
	ringGrey.Init("ring.opm");

	effect = OPeffectGen(
		"Common/Blinn.vert",
		"Common/BlinnColor.frag",
		OPATTR_POSITION | OPATTR_NORMAL,
		"Model Effect",
		ringX.mesh->vertexLayout.stride);

	effectTextured = OPeffectGen(
		"Common/Texture3D.vert",
		"Common/Texture.frag",
		OPATTR_POSITION | OPATTR_NORMAL | OPATTR_UV,
		"Textured Effect",
		arrow.mesh->vertexLayout.stride);

	colorRed = OPvec4(1, 0, 0, 1);
	colorGreen = OPvec4(1, 1, 0, 1);
	colorBlue = OPvec4(0, 0, 1, 1);
	colorGrey = OPvec4(0.7, 0.7, 0.7, 1);

	materialRed.Init(&effect);
	materialRed.AddParam("uColor", &colorRed);

	materialGreen.Init(&effect);
	materialGreen.AddParam("uColor", &colorGreen);

	materialBlue.Init(&effect);
	materialBlue.AddParam("uColor", &colorBlue);

	materialGrey.Init(&effect);
	materialGrey.AddParam("uColor", &colorGrey);

	texture = (OPtexture*)OPcmanLoadGet("person.png");
	materialColored.Init(&effectTextured);
	materialColored.AddParam("uColorTexture", texture);

	scene.Add(&ringX, &materialRed);
	scene.Add(&ringY, &materialGreen);
	scene.Add(&ringZ, &materialBlue);
	scene.Add(&arrow, &materialColored);

	rotation = OPvec3(0);
	rotationTarget = OPvec3(0);

	OPcmanLoad("Ubuntu.opf");

	OPfontSystemLoadEffects();
	FontManager = OPfontManagerSetup("Ubuntu.opf", NULL, 0);
	FontManager->_align = OPfontAlign::OPFONT_ALIGN_CENTER;
	FontManager->scale = 0.5;

}