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


C++ ManualObject::setCastShadows方法代码示例

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


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

示例1:

//  util
//---------------------------------------------------------------------------------------------------------------
ManualObject* App::Create2D(const String& mat, Real s, bool dyn)
{
	ManualObject* m = mSceneMgr->createManualObject();
	m->setDynamic(dyn);
	m->setUseIdentityProjection(true);
	m->setUseIdentityView(true);
	m->setCastShadows(false);
	m->estimateVertexCount(4);
	m->begin(mat, RenderOperation::OT_TRIANGLE_STRIP);
	m->position(-s,-s*asp, 0);  m->textureCoord(0, 1);
	m->position( s,-s*asp, 0);  m->textureCoord(1, 1);
	m->position(-s, s*asp, 0);  m->textureCoord(0, 0);
	m->position( s, s*asp, 0);  m->textureCoord(1, 0);
	m->end();
 
	//TODO:replace OT_TRIANGLE_FAN with a more friendly version for D3D11 as it is not supported
	/*
	m->estimateVertexCount(6);
	m->begin(mat, RenderOperation::OT_TRIANGLE_LIST);

	m->position(-s,-s*asp, 0);  m->textureCoord(0, 1);
	m->position( s,-s*asp, 0);  m->textureCoord(1, 1);
	m->position( s, s*asp, 0);  m->textureCoord(1, 0);
	m->position(-s, s*asp, 0);  m->textureCoord(0, 0);
	m->position(-s,-s*asp, 0);  m->textureCoord(0, 1);
	m->position( s, s*asp, 0);  m->textureCoord(1, 0);
	m->end();
	*/
	AxisAlignedBox aabInf;	aabInf.setInfinite();
	m->setBoundingBox(aabInf);  // always visible
	m->setRenderQueueGroup(RQG_Hud2);
	return m;
}
开发者ID:jsj2008,项目名称:stuntrally,代码行数:35,代码来源:OgreApp.cpp

示例2: CreateRacingLine

void App::CreateRacingLine()
{
	//void ROADPATCH::AddRacinglineScenenode(SCENENODE * node, ROADPATCH * nextpatch,	
	ManualObject* m = mSceneMgr->createManualObject();
	m->begin("track/Racingline", RenderOperation::OT_TRIANGLE_LIST);
	int ii = 0;

	const std::list <ROADSTRIP>& roads = pGame->track.GetRoadList();
	for (std::list <ROADSTRIP>::const_iterator it = roads.begin(); it != roads.end(); ++it)
	{
		const std::list <ROADPATCH>& pats = (*it).GetPatchList();
		for (std::list <ROADPATCH>::const_iterator i = pats.begin(); i != pats.end(); ++i)
		{
			const VERTEXARRAY* a = &((*i).racingline_vertexarray);
			if (!a)  continue;

			int verts = a->vertices.size();
			if (verts == 0)  continue;
			int faces = a->faces.size();

			for (int v = 0; v < verts; v += 3)
				m->position(a->vertices[v+0], a->vertices[v+2], -a->vertices[v+1]);

			for (int f = 0; f < faces; ++f)
				m->index(ii + a->faces[f]);

			ii += verts/3;
		}
	}
	m->setCastShadows(false);	
	m->end();
	hud->ndLine = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	hud->ndLine->attachObject(m);
	//ndLine->setVisible(pSet->racingline);
}
开发者ID:HaohaoLau,项目名称:stuntrally,代码行数:35,代码来源:TrackVdr.cpp

示例3: CreatePart

//  CreatePart mesh
//---------------------------------------------------
void CarModel::CreatePart(SceneNode* ndCar, Vector3 vPofs,
	String sCar2, String sCarI, String sMesh, String sEnt,
	bool ghost, uint32 visFlags,
	AxisAlignedBox* bbox, String stMtr, VERTEXARRAY* var, bool bLogInfo)
{
	if (FileExists(sCar2 + sMesh))
	{
		Entity* ent = mSceneMgr->createEntity(sCarI + sEnt, sDirname + sMesh, sCarI);
		if (bbox)  *bbox = ent->getBoundingBox();
		if (ghost)  {  ent->setRenderQueueGroup(RQG_CarGhost);  ent->setCastShadows(false);  }
		else  if (visFlags == RV_CarGlass)  ent->setRenderQueueGroup(RQG_CarGlass);
		ndCar->attachObject(ent);  ent->setVisibilityFlags(visFlags);
		if (bLogInfo)  LogMeshInfo(ent, sDirname + sMesh);
	}
	else
	{	ManualObject* mo = pApp->CreateModel(mSceneMgr, stMtr, var, vPofs, false, false, sCarI+sEnt);
		if (!mo)  return;
		if (bbox)  *bbox = mo->getBoundingBox();
		if (ghost)  {  mo->setRenderQueueGroup(RQG_CarGhost);  mo->setCastShadows(false);  }
		else  if (visFlags == RV_CarGlass)  mo->setRenderQueueGroup(RQG_CarGlass);
		ndCar->attachObject(mo);  mo->setVisibilityFlags(visFlags);
	
		/** ///  save .mesh
		MeshPtr mpCar = mInter->convertToMesh("Mesh" + sEnt);
		MeshSerializer* msr = new MeshSerializer();
		msr->exportMesh(mpCar.getPointer(), sDirname + sMesh);/**/
	}
}
开发者ID:isaaclacoba,项目名称:stuntrally,代码行数:30,代码来源:CarModel_Create.cpp

示例4: CreateSkyDome

//  Sky Dome
//-------------------------------------------------------------------------------------
void CScene::CreateSkyDome(String sMater, Vector3 sc, float yaw)
{
	ManualObject* m = app->mSceneMgr->createManualObject();
	m->begin(sMater, RenderOperation::OT_TRIANGLE_LIST);

	//  divisions- quality
	int ia = 32*2, ib = 24,iB = 24 +1/*below_*/, i=0;
	//int ia = 4, ib = 4, i=0;
	//  angles, max
	float a,b;  const float B = PI_d/2.f, A = 2.f*PI_d;
	float bb = B/ib, aa = A/ia;  // add
	ia += 1;

	//  up/dn y  )
	for (b = 0.f; b <= B+bb/*1*/*iB; b += bb)
	{
		float cb = sinf(b), sb = cosf(b);
		float y = sb;

		//  circle xz  o
		for (a = 0.f; a <= A; a += aa, ++i)
		{
			float x = cosf(a)*cb, z = sinf(a)*cb;
			m->position(x,y,z);

			m->textureCoord(a/A, b/B);

			if (a > 0.f && b > 0.f)  // rect 2tri
			{
				m->index(i-1);  m->index(i);     m->index(i-ia);
				m->index(i-1);  m->index(i-ia);  m->index(i-ia-1);
			}
		}
	}
	m->end();
	AxisAlignedBox aab;  aab.setInfinite();
	m->setBoundingBox(aab);  // always visible
	m->setRenderQueueGroup(RQG_Sky);
	m->setCastShadows(false);
	#ifdef SR_EDITOR
	m->setVisibilityFlags(RV_Sky);  // hide on minimap
	#endif

	app->ndSky = app->mSceneMgr->getRootSceneNode()->createChildSceneNode();
	app->ndSky->attachObject(m);
	app->ndSky->setScale(sc);
	Quaternion q;  q.FromAngleAxis(Degree(-yaw), Vector3::UNIT_Y);
	app->ndSky->setOrientation(q);
}
开发者ID:Mixone-FinallyHere,项目名称:stuntrally,代码行数:51,代码来源:Sky.cpp

示例5: if

ManualObject* CHud::Create2D(const String& mat, SceneManager* sceneMgr,
	Real s,  // scale pos
	bool dyn, bool clr,
	Real mul, Vector2 ofs,
	uint32 vis, uint8 rndQue,
	int cnt)
{
	ManualObject* m = sceneMgr->createManualObject();
	m->setDynamic(dyn);
	m->setUseIdentityProjection(true);
	m->setUseIdentityView(true);
	m->setCastShadows(false);

	m->estimateVertexCount(cnt * 4);
	m->begin(mat, cnt > 1 ? RenderOperation::OT_TRIANGLE_LIST : RenderOperation::OT_TRIANGLE_STRIP);
	const static Vector2 uv[4] = { Vector2(0.f,1.f),Vector2(1.f,1.f),Vector2(0.f,0.f),Vector2(1.f,0.f) };

	for (int i=0; i < cnt; ++i)
	{	m->position(-s,-s*asp, 0);  m->textureCoord(uv[0]*mul + ofs);  if (clr)  m->colour(0,1,0);
		m->position( s,-s*asp, 0);  m->textureCoord(uv[1]*mul + ofs);  if (clr)  m->colour(0,0,0);
		m->position(-s, s*asp, 0);  m->textureCoord(uv[2]*mul + ofs);  if (clr)  m->colour(1,1,0);
		m->position( s, s*asp, 0);  m->textureCoord(uv[3]*mul + ofs);  if (clr)  m->colour(1,0,0);
	}
	if (cnt > 1)
	for (int i=0; i < cnt; ++i)
	{	int n = i*4;
		m->quad(n,n+1,n+3,n+2);
	}
	m->end();
 
	AxisAlignedBox aabInf;	aabInf.setInfinite();
	m->setBoundingBox(aabInf);  // always visible
	m->setVisibilityFlags(vis);
	m->setRenderQueueGroup(rndQue);  //RQG_Hud2
	return m;
}
开发者ID:dimaursu,项目名称:stuntrally,代码行数:36,代码来源:CHud.cpp

示例6: CreateVdrTrack

void App::CreateVdrTrack(std::string strack, TRACK* pTrack)
{	
	//  materials  -------------
	std::vector<OGRE_MESH>& meshes = pTrack->ogre_meshes;
	std::string sMatCache = strack + ".matdef", sMatOrig = "_" + sMatCache,
		sPathCache = PATHMANAGER::ShaderDir() + "/" + sMatCache, sPathOrig = gcom->TrkDir() +"objects/"+ sMatOrig;
	bool hasMatOrig = boost::filesystem::exists(sPathOrig), hasMatCache = boost::filesystem::exists(sPathCache);
	bool bGenerate = 0, gen = !hasMatOrig && !hasMatCache || bGenerate;  // set 1 to force generate for new vdrift tracks


	//TODO .mat ..rewrite this code for new system
#if 0
	if (gen)
	{
		String sMtrs;
		for (int i=0; i < meshes.size(); i++)
		{
			OGRE_MESH& msh = meshes[i];
			if (msh.sky /*&& ownSky*/)  continue;
			if (!msh.newMtr)  continue;  //  create material if new

			bool found = true;
			TexturePtr tex = TextureManager::getSingleton().getByName(msh.material);
			if (tex.isNull())
			try{
				tex = TextureManager::getSingleton().load(msh.material, rgDef);  }
			catch(...){
				found = false;  }
			msh.found = found;  // dont create meshes for not found textures, test
			if (!found)  continue;

			#if 0  // use 0 for some tracks (eg.zandvoort) - have alpha textures for all!
			if (!tex.isNull() && tex->hasAlpha())
				msh.alpha = true;  // for textures that have alpha
			#endif

			if (msh.alpha)
				sMtrs += "["+msh.material+"]\n"+
					"	parent = 0vdrAlpha\n"+
					"	diffuseMap_512 = "+msh.material+"\n";
			else
				sMtrs += "["+msh.material+"]\n"+
					"	parent = 0vdrTrk\n"+
					"	diffuseMap_512 = "+msh.material+"\n";
		}

		std::ofstream fileout(sPathCache.c_str());
		if (!fileout)  LogO("Error: Can't save vdrift track matdef!");
		fileout.write(sMtrs.c_str(), sMtrs.size());
		fileout.close();
		hasMatCache = true;
	}
#endif
	

	//  meshes  -------------
	std::vector<Entity*> ents;
	static int ii = 0;  int i;
	for (i=0; i < meshes.size(); ++i)
	{
		OGRE_MESH& msh = meshes[i];
		if (msh.sky /*&& ownSky*/)  continue;
		if (!msh.found)  continue;

		//if (strstr(msh.material.c_str(), "tree")!=0)  continue;

		//LogO( String("---  model: ") + msh.name + " mtr:" + msh.material +
		//" v:" + toStr(msh.mesh->vertices.size()) + " f:" + toStr(msh.mesh->faces.size()) );

		//if (ownSky && msh.sky)
		if (!msh.sky)
		{
		ManualObject* m = CreateModel(mSceneMgr, msh.material, msh.mesh, Vector3(0,0,0), false, true);
		//if (!m)  continue;
		if (msh.sky)
			m->setCastShadows(false);
		
		MeshPtr mp = m->convertToMesh("m"+toStr(ii+i));
		Entity* e = mSceneMgr->createEntity(mp);

		ents.push_back(e);
		}
	}
	ii += i;

	//  static geom  -------------
	scn->vdrTrack = mSceneMgr->createStaticGeometry("track");
	scn->vdrTrack->setRegionDimensions(Vector3::UNIT_SCALE * 1000);  // 1000
	scn->vdrTrack->setOrigin(Vector3::ZERO);
	scn->vdrTrack->setCastShadows(true);

	for (std::vector<Entity*>::iterator it = ents.begin(); it != ents.end(); ++it)
		scn->vdrTrack->addEntity(*it, Vector3::ZERO);

	scn->vdrTrack->build();
	//mStaticGeom->dump("_track-sg.txt");
}
开发者ID:HaohaoLau,项目名称:stuntrally,代码行数:97,代码来源:TrackVdr.cpp

示例7: CreateVdrMinimap

ManualObject* CHud::CreateVdrMinimap()
{
	asp = float(app->mWindow->getWidth())/float(app->mWindow->getHeight());

	//  get track sizes
	minX=FLT_MAX; maxX=FLT_MIN;  minY=FLT_MAX; maxY=FLT_MIN;

	const std::list <ROADSTRIP>& roads = app->pGame->track.GetRoadList();
	for (std::list <ROADSTRIP>::const_iterator it = roads.begin(); it != roads.end(); ++it)
	{
		const std::list <ROADPATCH>& pats = (*it).GetPatchList();
		for (std::list <ROADPATCH>::const_iterator i = pats.begin(); i != pats.end(); ++i)
		{
			for (int iy=0; iy<4; ++iy)
			for (int ix=0; ix<4; ++ix)
			{
				const MATHVECTOR<float,3>& vec = (*i).GetPatch().GetPoint(ix,iy);

				Real x = vec[0], y = vec[2];
				if (x < minX)  minX = x;	if (x > maxX)  maxX = x;
				if (y < minY)  minY = y;	if (y > maxY)  maxY = y;
			}
		}
	}

	float fMapSizeX = maxX - minX, fMapSizeY = maxY - minY;  // map size
	float size = std::max(fMapSizeX, fMapSizeY);
	scX = 1.f / size;  scY = 1.f / size;

	ManualObject* m = app->mSceneMgr->createManualObject();
	m->begin("hud/Minimap", RenderOperation::OT_TRIANGLE_LIST);
	int ii = 0;

	for (std::list <ROADSTRIP>::const_iterator it = roads.begin(); it != roads.end(); ++it)
	{
		const std::list <ROADPATCH>& pats = (*it).GetPatchList();
		for (std::list <ROADPATCH>::const_iterator i = pats.begin(); i != pats.end(); ++i)
		{
			float p[16][3];  int a=0;
			for (int y=0; y<4; ++y)
			for (int x=0; x<4; ++x)
			{
				const MATHVECTOR<float,3>& vec = (*i).GetPatch().GetPoint(x,y);
				p[a][0] = vec[0];  p[a][1] = vec[2];  p[a][2] = vec[1];  a++;
			}
			a = 0;

			// normal
			Vector3 pos (p[a  ][2], -p[a  ][0], p[a  ][1]);
			Vector3 posX(p[a+3][2], -p[a+3][0], p[a+3][1]);   posX-=pos;  posX.normalise();
			Vector3 posY(p[a+12][2],-p[a+12][0],p[a+12][1]);  posY-=pos;  posY.normalise();
			Vector3 norm = posX.crossProduct(posY);  norm.normalise();/**/

			for (int y=0; y<4; ++y)
			for (int x=0; x<4; ++x)
			{
				Vector3 pos( (p[a][0] - minX)*scX*2-1,	// pos x,y = -1..1
							-(p[a][1] - minY)*scY*2+1, 0);  a++;
				m->position(pos);
				m->normal(norm);/**/

				Real c = std::min(1.f, std::max(0.3f, 1.f - 2.4f * powf( fabs(norm.y)
					/*norm.absDotProduct(vLi)*/, 0.7f) ));
				m->colour(ColourValue(c,c,c,1));

				m->textureCoord(x/3.f,y/3.f);
				if (x<3 && y<3)
				{
					int a = ii+x+y*4;
					m->index(a+0);	m->index(a+1);	m->index(a+4);
					m->index(a+1);	m->index(a+4);	m->index(a+5);
				}
			}
			ii += 16;
		}
	}
	m->end();
	m->setUseIdentityProjection(true);  m->setUseIdentityView(true);  // on hud
	m->setCastShadows(false);
	AxisAlignedBox aab;  aab.setInfinite();  m->setBoundingBox(aab);  // draw always
	m->setRenderingDistance(100000.f);
	m->setRenderQueueGroup(RQG_Hud2);  m->setVisibilityFlags(RV_Hud);
	return m;
}
开发者ID:HaohaoLau,项目名称:stuntrally,代码行数:84,代码来源:TrackVdr.cpp

示例8: Create

//-------------------------------------------------------------------------------------------------------
//  Create
//-------------------------------------------------------------------------------------------------------
void CarModel::Create()
{
	//if (!pCar)  return;

	String strI = toStr(iIndex)+ (eType == CT_TRACK ? "Z" : (eType == CT_GHOST2 ? "V" :""));
	mtrId = strI;
	String sCarI = "Car" + strI;
	resGrpId = sCarI;

	String sCars = PATHMANAGER::Cars() + "/" + sDirname;
	resCar = sCars + "/textures";
	String rCar = resCar + "/" + sDirname;
	String sCar = sCars + "/" + sDirname;
	
	bool ghost = false;  //isGhost();  //1 || for ghost test
	bool bLogInfo = !isGhost();  // log mesh info
	bool ghostTrk = isGhostTrk();
	
	//  Resource locations -----------------------------------------
	/// Add a resource group for this car
	ResourceGroupManager::getSingleton().createResourceGroup(resGrpId);
	Ogre::Root::getSingletonPtr()->addResourceLocation(sCars, "FileSystem", resGrpId);
	Ogre::Root::getSingletonPtr()->addResourceLocation(sCars + "/textures", "FileSystem", resGrpId);
		
	pMainNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	SceneNode* ndCar = pMainNode->createChildSceneNode();

	//  --------  Follow Camera  --------
	if (mCamera && pCar)
	{
		fCam = new FollowCamera(mCamera, pSet);
		fCam->chassis = pCar->dynamics.chassis;
		fCam->loadCameras();
		
		//  set in-car camera position to driver position
		for (std::vector<CameraAngle*>::iterator it=fCam->mCameraAngles.begin();
			it!=fCam->mCameraAngles.end(); ++it)
		{
			if ((*it)->mName == "Car driver")
				(*it)->mOffset = Vector3(driver_view[0], driver_view[2], -driver_view[1]);
			else if ((*it)->mName == "Car bonnet")
				(*it)->mOffset = Vector3(hood_view[0], hood_view[2], -hood_view[1]);
		}
	}
			
	CreateReflection();
	

	//  next checkpoint marker
	bool deny = pApp->gui->pChall && !pApp->gui->pChall->chk_beam;
	if (eType == CT_LOCAL && !deny)
	{
		entNextChk = mSceneMgr->createEntity("Chk"+strI, "check.mesh");
		entNextChk->setRenderQueueGroup(RQG_Weather);  entNextChk->setCastShadows(false);
		ndNextChk = mSceneMgr->getRootSceneNode()->createChildSceneNode();
		ndNextChk->attachObject(entNextChk);  entNextChk->setVisibilityFlags(RV_Hud);
		ndNextChk->setVisible(false);
	}


	///()  grass sphere test
	#if 0
	Entity* es = mSceneMgr->createEntity(sCarI+"s", "sphere.mesh", sCarI);
	es->setRenderQueueGroup(RQG_CarGhost);
	MaterialPtr mtr = MaterialManager::getSingleton().getByName("pipeGlass");
	es->setMaterial(mtr);
	ndSph = mSceneMgr->getRootSceneNode()->createChildSceneNode();
	ndSph->attachObject(es);
	#endif


	///  Create Models:  body, interior, glass
	//-------------------------------------------------
	Vector3 vPofs(0,0,0);
	AxisAlignedBox bodyBox;  uint8 g = RQG_CarGhost;
	all_subs=0;  all_tris=0;  //stats
	
	if (bRotFix)
		ndCar->setOrientation(Quaternion(Degree(90),Vector3::UNIT_Y)*Quaternion(Degree(180),Vector3::UNIT_X));


	CreatePart(ndCar, vPofs, sCar, sCarI, "_body.mesh",     "",  ghost, RV_Car,  &bodyBox,  sMtr[Mtr_CarBody], pCar ? &pCar->bodymodel.mesh : 0,     bLogInfo);

	vPofs = Vector3(interiorOffset[0],interiorOffset[1],interiorOffset[2]);  //x+ back y+ down z+ right
	if (!ghost)
	CreatePart(ndCar, vPofs, sCar, sCarI, "_interior.mesh", "i", ghost, RV_Car,      0, sMtr[Mtr_CarBody]+"i", pCar ? &pCar->interiormodel.mesh : 0, bLogInfo);

	vPofs = Vector3::ZERO;
	CreatePart(ndCar, vPofs, sCar, sCarI, "_glass.mesh",    "g", ghost, RV_CarGlass, 0, sMtr[Mtr_CarBody]+"g", pCar ? &pCar->glassmodel.mesh : 0,    bLogInfo);
	

	//  wheels  ----------------------
	for (int w=0; w < 4; ++w)
	{
		String siw = "Wheel" + strI + "_" + toStr(w);
		ndWh[w] = mSceneMgr->getRootSceneNode()->createChildSceneNode();

//.........这里部分代码省略.........
开发者ID:isaaclacoba,项目名称:stuntrally,代码行数:101,代码来源:CarModel_Create.cpp


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