Exemplo n.º 1
0
	void llquat_test_object_t::test<2>()
	{
		LLMatrix4 llmat;
		LLVector4 vector1(2.0f, 1.0f, 3.0f, 6.0f);
		LLVector4 vector2(5.0f, 6.0f, 0.0f, 1.0f);
		LLVector4 vector3(2.0f, 1.0f, 2.0f, 9.0f);
		LLVector4 vector4(3.0f, 8.0f, 1.0f, 5.0f);

		llmat.initRows(vector1, vector2, vector3, vector4);
		ensure("explicit LLQuaternion(const LLMatrix4 &mat) failed", 2.0f == llmat.mMatrix[0][0] &&
										 	1.0f == llmat.mMatrix[0][1] &&
											3.0f == llmat.mMatrix[0][2] &&
											6.0f == llmat.mMatrix[0][3] &&
											5.0f == llmat.mMatrix[1][0] &&
											6.0f == llmat.mMatrix[1][1] &&
											0.0f == llmat.mMatrix[1][2] &&
											1.0f == llmat.mMatrix[1][3] &&
											2.0f == llmat.mMatrix[2][0] &&
											1.0f == llmat.mMatrix[2][1] &&
											2.0f == llmat.mMatrix[2][2] &&
											9.0f == llmat.mMatrix[2][3] &&
											3.0f == llmat.mMatrix[3][0] &&
											8.0f == llmat.mMatrix[3][1] &&
											1.0f == llmat.mMatrix[3][2] &&
											5.0f == llmat.mMatrix[3][3]);
	}
Exemplo n.º 2
0
void LLDrawPoolBump::beginFullbrightShiny()
{
	LLFastTimer t(FTM_RENDER_SHINY);
	if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY))
	{
		return;
	}

	sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0;

	// Second pass: environment map
	
	if (LLPipeline::sUnderWaterRender)
	{
		shader = &gObjectFullbrightShinyWaterProgram;
	}
	else
	{
		shader = &gObjectFullbrightShinyProgram;
	}

	LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
	if( cube_map )
	{
		LLMatrix4 mat;
		mat.initRows(LLVector4(gGLModelView+0),
					 LLVector4(gGLModelView+4),
					 LLVector4(gGLModelView+8),
					 LLVector4(gGLModelView+12));
		shader->bind();
		LLVector3 vec = LLVector3(gShinyOrigin) * mat;
		LLVector4 vec4(vec, gShinyOrigin.mV[3]);
		shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV);			

		cube_map->setMatrix(1);
		// Make sure that texture coord generation happens for tex unit 1, as that's the one we use for 
		// the cube map in the one pass shiny shaders
		gGL.getTexUnit(1)->disable();
		cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
		cube_map->enableTexture(cube_channel);
		cube_map->enableTextureCoords(1);
		diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);

		gGL.getTexUnit(cube_channel)->bind(cube_map);
		gGL.getTexUnit(0)->activate();
	}

	if (mVertexShaderLevel > 1)
	{ //indexed texture rendering, channel 0 is always diffuse
		diffuse_channel = 0;
	}

	mShiny = TRUE;
}
Exemplo n.º 3
0
LLMatrix4& LLDrawPoolAvatar::getModelView()
{
	static LLMatrix4 ret;

	ret.initRows(LLVector4(gGLModelView+0),
				 LLVector4(gGLModelView+4),
				 LLVector4(gGLModelView+8),
				 LLVector4(gGLModelView+12));

	return ret;
}
Exemplo n.º 4
0
//static
void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel, bool invisible)
{
	LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
	if( cube_map )
	{
		if (!invisible && shader )
		{
			LLMatrix4 mat;
			mat.initRows(LLVector4(gGLModelView+0),
						 LLVector4(gGLModelView+4),
						 LLVector4(gGLModelView+8),
						 LLVector4(gGLModelView+12));
			LLVector3 vec = LLVector3(gShinyOrigin) * mat;
			LLVector4 vec4(vec, gShinyOrigin.mV[3]);
			shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV);			
			if (shader_level > 1)
			{
				cube_map->setMatrix(1);
				// Make sure that texture coord generation happens for tex unit 1, as that's the one we use for 
				// the cube map in the one pass shiny shaders
				cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
				cube_map->enableTexture(cube_channel);
				cube_map->enableTextureCoords(1);
				diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
			}
			else
			{
				cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
				diffuse_channel = -1;
				cube_map->setMatrix(0);
				cube_map->enable(cube_channel);
			}			
			gGL.getTexUnit(cube_channel)->bind(cube_map);
			gGL.getTexUnit(0)->activate();
		}
		else
		{
			cube_channel = 0;
			diffuse_channel = -1;
			gGL.getTexUnit(0)->disable();
			cube_map->enable(0);
			cube_map->setMatrix(0);
			gGL.getTexUnit(0)->bind(cube_map);

			gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
			gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA);
		}
	}
}
Exemplo n.º 5
0
//static
void LLDrawPoolBump::beginShiny(bool invisible)
{
	LLFastTimer t(LLFastTimer::FTM_RENDER_SHINY);
	if (!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY)|| 
		invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY))
	{
		return;
	}

	mShiny = TRUE;
	sVertexMask = VERTEX_MASK_SHINY;
	// Second pass: environment map
	if (!invisible && mVertexShaderLevel > 1)
	{
		sVertexMask = VERTEX_MASK_SHINY | LLVertexBuffer::MAP_TEXCOORD0;
	}
	
	if (LLPipeline::sUnderWaterRender)
	{
		shader = &gObjectShinyWaterProgram;
	}
	else
	{
		shader = &gObjectShinyProgram;
	}

	LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
	if( cube_map )
	{
		if (!invisible && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0 )
		{
			LLMatrix4 mat;
			mat.initRows(LLVector4(gGLModelView+0),
						 LLVector4(gGLModelView+4),
						 LLVector4(gGLModelView+8),
						 LLVector4(gGLModelView+12));
			shader->bind();
			LLVector3 vec = LLVector3(gShinyOrigin) * mat;
			LLVector4 vec4(vec, gShinyOrigin.mV[3]);
			shader->uniform4fv(LLViewerShaderMgr::SHINY_ORIGIN, 1, vec4.mV);			
			if (mVertexShaderLevel > 1)
			{
				cube_map->setMatrix(1);
				// Make sure that texture coord generation happens for tex unit 1, as that's the one we use for 
				// the cube map in the one pass shiny shaders
				cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
				cube_map->enableTexture(cube_channel);
				cube_map->enableTextureCoords(1);
				diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
			}
			else
			{
				cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
				diffuse_channel = -1;
				cube_map->setMatrix(0);
				cube_map->enable(cube_channel);
			}			
			gGL.getTexUnit(cube_channel)->bind(cube_map);
			gGL.getTexUnit(0)->activate();
		}
		else
		{
			cube_channel = 0;
			diffuse_channel = -1;
			gGL.getTexUnit(0)->disable();
			cube_map->enable(0);
			cube_map->setMatrix(0);
			gGL.getTexUnit(0)->bind(cube_map);

			gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
			gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA);
		}
	}
}