Historique des modifications - Message

Message #10828

Sujet: Avoir la main verte


TypeDateAuteurContenu
Création du message14-10-2012 07:10:43Memorial76
Il s'agit d'une version simplifiée de celle du tuto. Je n'ai gardé que ce qui m'intéressait (HLSL). J'ai également changé quelques noms de constantes histoire de les rendre plus parlantes pour moi. Mais je les ai également bien renommées dans les fichiers du shaders.
Merci


video::IVideoDriver* pDriver = pServices->getVideoDriver();
	core::matrix4 invertedWorldMatrix = pDriver->getTransform(video::ETS_WORLD);
	
	//inverted world matrix
	invertedWorldMatrix.makeInverse();
	pServices->setVertexShaderConstant("mInvertedWorld", invertedWorldMatrix.pointer(), 16);

	//clip matrix
	core::matrix4 worldViewProjectionMatrix;
	worldViewProjectionMatrix = pDriver->getTransform(video::ETS_PROJECTION);
	worldViewProjectionMatrix *= pDriver->getTransform(video::ETS_VIEW);
	worldViewProjectionMatrix *= pDriver->getTransform(video::ETS_WORLD);
	
	pServices->setVertexShaderConstant("mWorldViewProjection", worldViewProjectionMatrix.pointer(), 16);

	//Camera position
	
	core::vector3df CamPos = m_pDevice->getSceneManager()->getActiveCamera()->getAbsolutePosition();
	pServices->setVertexShaderConstant("mLightPosition", reinterpret_cast<f32*>(&CamPos), 3);

	//set LightColor
	video::SColorf LightColor(0.0f, 1.0f, 1.0f, 0.0f);
	pServices->setVertexShaderConstant("mLightColor", reinterpret_cast<f32*>(&LightColor), 4);

	//set transposed world matrix
	core::matrix4 transposedWorldMatrix = pDriver->getTransform(video::ETS_WORLD);
	transposedWorldMatrix.getTransposed();
	pServices->setVertexShaderConstant("mTransposedWorld", transposedWorldMatrix.pointer(), 16);

Retour

OptionsLiens officielsCaractéristiquesStatistiquesCommunauté
Préférences cookies
Corrections
irrlicht
irrklang
irredit
irrxml
Propulsé par Django
xhtml 1.0
css 2.1
884 membres
1441 sujets
11339 messages
Dernier membre inscrit: Saidov17
79 invités en ligne
membre en ligne: -
RSS Feed