Пример #1
0
void LLDrawPoolMaterials::beginDeferredPass(S32 pass)
{
	U32 shader_idx[] = 
	{
		0, //LLRenderPass::PASS_MATERIAL,
		//1, //LLRenderPass::PASS_MATERIAL_ALPHA,
		2, //LLRenderPass::PASS_MATERIAL_ALPHA_MASK,
		3, //LLRenderPass::PASS_MATERIAL_ALPHA_GLOW,
		4, //LLRenderPass::PASS_SPECMAP,
		//5, //LLRenderPass::PASS_SPECMAP_BLEND,
		6, //LLRenderPass::PASS_SPECMAP_MASK,
		7, //LLRenderPass::PASS_SPECMAP_GLOW,
		8, //LLRenderPass::PASS_NORMMAP,
		//9, //LLRenderPass::PASS_NORMMAP_BLEND,
		10, //LLRenderPass::PASS_NORMMAP_MASK,
		11, //LLRenderPass::PASS_NORMMAP_GLOW,
		12, //LLRenderPass::PASS_NORMSPEC,
		//13, //LLRenderPass::PASS_NORMSPEC_BLEND,
		14, //LLRenderPass::PASS_NORMSPEC_MASK,
		15, //LLRenderPass::PASS_NORMSPEC_GLOW,
	};
	
	mShader = &(gDeferredMaterialProgram[shader_idx[pass]]);

	if (LLPipeline::sUnderWaterRender)
	{
		mShader = &(gDeferredMaterialWaterProgram[shader_idx[pass]]);
	}

	mShader->bind();

	diffuse_channel = mShader->enableTexture(LLShaderMgr::DIFFUSE_MAP);
		
	LL_RECORD_BLOCK_TIME(FTM_RENDER_MATERIALS);
}
void LLDrawPoolAlpha::beginRenderPass(S32 pass)
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA);
	
	if (LLPipeline::sImpostorRender)
	{
		simple_shader = &gObjectSimpleImpostorProgram;
		fullbright_shader = &gObjectFullbrightProgram;
		emissive_shader = &gObjectEmissiveProgram;
	}
	else if (LLPipeline::sUnderWaterRender)
	{
		simple_shader = &gObjectSimpleWaterProgram;
		fullbright_shader = &gObjectFullbrightWaterProgram;
		emissive_shader = &gObjectEmissiveWaterProgram;
	}
	else
	{
		simple_shader = &gObjectSimpleProgram;
		fullbright_shader = &gObjectFullbrightProgram;
		emissive_shader = &gObjectEmissiveProgram;
	}

	if (mVertexShaderLevel > 0)
	{
		// Start out with no shaders.
		current_shader = target_shader = NULL;
		LLGLSLShader::bindNoShader();
	}
	gPipeline.enableLightsDynamic();
}
Пример #3
0
LLView *LLUICtrlFactory::createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t& registry, LLXMLNodePtr output_node)
{
	LL_RECORD_BLOCK_TIME(FTM_CREATE_FROM_XML);
	std::string ctrl_type = node->getName()->mString;
	LLStringUtil::toLower(ctrl_type);

	const LLWidgetCreatorFunc* funcp = registry.getValue(ctrl_type);
	if (funcp == NULL)
	{
		return NULL;
	}

	if (parent == NULL)
	{
		if (mDummyPanel == NULL)
		{
			LLPanel::Params p;
			mDummyPanel = create<LLPanel>(p);
		}
		parent = mDummyPanel;
	}
	LLView *view = (*funcp)(node, parent, output_node);	
	
	return view;
}
Пример #4
0
void LLPumpIO::callback()
{
	//LL_INFOS() << "LLPumpIO::callback()" << LL_ENDL;
	if(true)
	{
#if LL_THREADS_APR
		LLScopedLock lock(mCallbackMutex);
#endif
		std::copy(
			mPendingCallbacks.begin(),
			mPendingCallbacks.end(),
			std::back_insert_iterator<callbacks_t>(mCallbacks));
		mPendingCallbacks.clear();
	}
	if(!mCallbacks.empty())
	{
		callbacks_t::iterator it = mCallbacks.begin();
		callbacks_t::iterator end = mCallbacks.end();
		for(; it != end; ++it)
		{
			LL_RECORD_BLOCK_TIME(FTM_PUMP_CALLBACK_CHAIN);
			// it's always the first and last time for respone chains
			(*it).mHead = (*it).mChainLinks.begin();
			(*it).mInit = true;
			(*it).mEOS = true;
			processChain(*it);
		}
		mCallbacks.clear();
	}
}
Пример #5
0
void LLDrawPoolBump::beginRenderPass(S32 pass)
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP);
	switch( pass )
	{
		case 0:
			beginShiny();
			break;
		case 1:
			if (mVertexShaderLevel > 1)
			{
				beginFullbrightShiny();
			}
			else 
			{
				beginBump();
			}
			break;
		case 2:
			beginBump();
			break;
		default:
			llassert(0);
			break;
	}
}
Пример #6
0
void LLDrawPoolBump::endRenderPass(S32 pass)
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP);
	switch( pass )
	{
		case 0:
			endShiny();
			break;
		case 1:
			if (mVertexShaderLevel > 1)
			{
				endFullbrightShiny();
			}
			else 
			{
				endBump();
			}
			break;
		case 2:
			endBump();
			break;
		default:
			llassert(0);
			break;
	}

	//to cleanup texture channels
	LLRenderPass::endRenderPass(pass);
}
Пример #7
0
void LLDrawPoolBump::render(S32 pass)
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP);
	
	if (!gPipeline.hasRenderType(LLDrawPool::POOL_SIMPLE))
	{
		return;
	}
	
	switch( pass )
	{
		case 0:
			renderShiny();
			break;
		case 1:
			if (mVertexShaderLevel > 1)
			{
				renderFullbrightShiny();
			}
			else 
			{
				renderBump(); 
			}
			break;
		case 2:
			renderBump();
			break;
		default:
			llassert(0);
			break;
	}
}
Пример #8
0
void LLDrawPoolBump::renderShiny(bool invisible)
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY);
	if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| 
		(invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)))
	{
		return;
	}

	if( gSky.mVOSkyp->getCubeMap() )
	{
		LLGLEnable blend_enable(GL_BLEND);
		if (!invisible && mVertexShaderLevel > 1)
		{
			LLRenderPass::pushBatches(LLRenderPass::PASS_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
		}
		else if (!invisible)
		{
			renderGroups(LLRenderPass::PASS_SHINY, sVertexMask);
		}
		//else // invisible (deprecated)
		//{
			//renderGroups(LLRenderPass::PASS_INVISI_SHINY, sVertexMask);
		//}
	}
}
Пример #9
0
void LLDrawPoolBump::endFullbrightShiny()
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY);
	if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY))
	{
		return;
	}

	LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
	if( cube_map )
	{
		cube_map->disable();
		cube_map->restoreMatrix();

		/*if (diffuse_channel != 0)
		{
			shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
		}
		gGL.getTexUnit(0)->activate();
		gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);*/

		shader->unbind();
		//gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
	}
	
	//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
	//gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);

	diffuse_channel = -1;
	cube_channel = 0;
	mShiny = FALSE;
}
Пример #10
0
void LLDrawPoolMaterials::endDeferredPass(S32 pass)
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_MATERIALS);

	mShader->unbind();

	LLRenderPass::endRenderPass(pass);
}
void LLDrawPoolAlpha::endRenderPass( S32 pass )
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA);
	LLRenderPass::endRenderPass(pass);

	if(gPipeline.canUseWindLightShaders()) 
	{
		LLGLSLShader::bindNoShader();
	}
}
Пример #12
0
BOOL LLUICtrl::focusFirstItem(BOOL prefer_text_fields, BOOL focus_flash)
{
	LL_RECORD_BLOCK_TIME(FTM_FOCUS_FIRST_ITEM);
	// try to select default tab group child
	LLCtrlQuery query = getTabOrderQuery();
	// sort things such that the default tab group is at the front
	query.setSorter(DefaultTabGroupFirstSorter::getInstance());
	viewList_t result = query(this);
	if(!result.empty())
	{
		LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
		if(!ctrl->hasFocus())
		{
			ctrl->setFocus(TRUE);
			ctrl->onTabInto();  
			if(focus_flash)
			{
				gFocusMgr.triggerFocusFlash();
			}
		}
		return TRUE;
	}	
	// search for text field first
	if(prefer_text_fields)
	{
		LLCtrlQuery query = getTabOrderQuery();
		query.addPreFilter(LLUICtrl::LLTextInputFilter::getInstance());
		viewList_t result = query(this);
		if(result.size() > 0)
		{
			LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
			if(!ctrl->hasFocus())
			{
				ctrl->setFocus(TRUE);
				ctrl->onTabInto();  
				gFocusMgr.triggerFocusFlash();
			}
			return TRUE;
		}
	}
	// no text field found, or we don't care about text fields
	result = getTabOrderQuery().run(this);
	if(result.size() > 0)
	{
		LLUICtrl * ctrl = static_cast<LLUICtrl*>(result.front());
		if(!ctrl->hasFocus())
		{
			ctrl->setFocus(TRUE);
			ctrl->onTabInto();  
			gFocusMgr.triggerFocusFlash();
		}
		return TRUE;
	}	
	return FALSE;
}
// virtual
LLIOPipe::EStatus LLFilterSD2XMLRPCResponse::process_impl(
	const LLChannelDescriptors& channels,
	buffer_ptr_t& buffer,
	bool& eos,
	LLSD& context,
	LLPumpIO* pump)
{
	LL_RECORD_BLOCK_TIME(FTM_PROCESS_SD2XMLRPC_RESPONSE);

	PUMP_DEBUG;
	// This pipe does not work if it does not have everyting. This
	// could be addressed by making a stream parser for llsd which
	// handled partial information.
	if(!eos)
	{
		return STATUS_BREAK;
	}

	PUMP_DEBUG;
	// we have everyting in the buffer, so turn the structure data rpc
	// response into an xml rpc response.
	LLBufferStream stream(channels, buffer.get());
	stream << XML_HEADER << XMLRPC_METHOD_RESPONSE_HEADER << std::flush;	// Flush, or buffer->count() returns too much!
	LLSD sd;
	LLSDSerialize::fromNotation(sd, stream, buffer->count(channels.in()));

	PUMP_DEBUG;
	LLIOPipe::EStatus rv = STATUS_ERROR;
	if(sd.has("response"))
	{
		PUMP_DEBUG;
		// it is a normal response. pack it up and ship it out.
		stream.precision(DEFAULT_PRECISION);
		stream << XMLRPC_RESPONSE_HEADER;
		streamOut(stream, sd["response"]);
		stream << XMLRPC_RESPONSE_FOOTER << XMLRPC_METHOD_RESPONSE_FOOTER;
		rv = STATUS_DONE;
	}
	else if(sd.has("fault"))
	{
		PUMP_DEBUG;
		// it is a fault.
		stream << XMLRPC_FAULT_1 << sd["fault"]["code"].asInteger()
			<< XMLRPC_FAULT_2
			<< xml_escape_string(sd["fault"]["description"].asString())
			<< XMLRPC_FAULT_3 << XMLRPC_METHOD_RESPONSE_FOOTER;
		rv = STATUS_DONE;
	}
	else
	{
		LL_WARNS() << "Unable to determine the type of LLSD response." << LL_ENDL;
	}
	PUMP_DEBUG;
	return rv;
}
void LLWaterParamManager::update(LLViewerCamera * cam)
{
	LL_RECORD_BLOCK_TIME(FTM_UPDATE_WATERPARAM);
	
	// update the shaders and the menu
	propagateParameters();
	
	// only do this if we're dealing with shaders
	if(gPipeline.canUseVertexShaders()) 
	{
		//transform water plane to eye space
		glh::vec3f norm(0.f, 0.f, 1.f);
		glh::vec3f p(0.f, 0.f, gAgent.getRegion()->getWaterHeight()+0.1f);
		
		F32 modelView[16];
		for (U32 i = 0; i < 16; i++)
		{
			modelView[i] = (F32) gGLModelView[i];
		}

		glh::matrix4f mat(modelView);
		glh::matrix4f invtrans = mat.inverse().transpose();
		glh::vec3f enorm;
		glh::vec3f ep;
		invtrans.mult_matrix_vec(norm, enorm);
		enorm.normalize();
		mat.mult_matrix_vec(p, ep);

		mWaterPlane = LLVector4(enorm.v[0], enorm.v[1], enorm.v[2], -ep.dot(enorm));

		LLVector3 sunMoonDir;
		if (gSky.getSunDirection().mV[2] > LLSky::NIGHTTIME_ELEVATION_COS) 	 
		{ 	 
			sunMoonDir = gSky.getSunDirection(); 	 
		} 	 
		else  	 
		{ 	 
			sunMoonDir = gSky.getMoonDirection(); 	 
		}
		sunMoonDir.normVec();
		mWaterFogKS = 1.f/llmax(sunMoonDir.mV[2], WATER_FOG_LIGHT_CLAMP);

		LLViewerShaderMgr::shader_iter shaders_iter, end_shaders;
		end_shaders = LLViewerShaderMgr::instance()->endShaders();
		for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
		{
			if (shaders_iter->mProgramObject != 0
				&& shaders_iter->mShaderGroup == LLGLSLShader::SG_WATER)
			{
				shaders_iter->mUniformsDirty = TRUE;
			}
		}
	}
}
Пример #15
0
void LLDrawPoolBump::endDeferredPass(S32 pass)
{
	if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP))
	{
		return;
	}
	LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP);
	mShiny = FALSE;
	gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
	gDeferredBumpProgram.disableTexture(LLViewerShaderMgr::BUMP_MAP);
	gDeferredBumpProgram.unbind();
	gGL.getTexUnit(0)->activate();
}
Пример #16
0
//static
void LLDrawPoolBump::beginBump(U32 pass)
{	
	if (!gPipeline.hasRenderBatches(pass))
	{
		return;
	}

	sVertexMask = VERTEX_MASK_BUMP;
	LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP);
	// Optional second pass: emboss bump map
	stop_glerror();

	if (LLGLSLShader::sNoFixedFunction)
	{
		gObjectBumpProgram.bind();
	}
	else
	{
		// TEXTURE UNIT 0
		// Output.rgb = texture at texture coord 0
		gGL.getTexUnit(0)->activate();

		gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
		gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);

		// TEXTURE UNIT 1
		gGL.getTexUnit(1)->activate();
 
		gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);

		gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD_SIGNED, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_ONE_MINUS_TEX_ALPHA);
		gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);

		// src	= tex0 + (1 - tex1) - 0.5
		//		= (bump0/2 + 0.5) + (1 - (bump1/2 + 0.5)) - 0.5
		//		= (1 + bump0 - bump1) / 2


		// Blend: src * dst + dst * src
		//		= 2 * src * dst
		//		= 2 * ((1 + bump0 - bump1) / 2) * dst   [0 - 2 * dst]
		//		= (1 + bump0 - bump1) * dst.rgb
		//		= dst.rgb + dst.rgb * (bump0 - bump1)

		gGL.getTexUnit(0)->activate();
		gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
	}

	gGL.setSceneBlendType(LLRender::BT_MULT_X2);
	stop_glerror();
}
Пример #17
0
void LLDrawPoolBump::beginDeferredPass(S32 pass)
{
	if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_BUMP))
	{
		return;
	}
	LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP);
	mShiny = TRUE;
	gDeferredBumpProgram.bind();
	diffuse_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
	bump_channel = gDeferredBumpProgram.enableTexture(LLViewerShaderMgr::BUMP_MAP);
	gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
	gGL.getTexUnit(bump_channel)->unbind(LLTexUnit::TT_TEXTURE);
}
Пример #18
0
//-----------------------------------------------------------------------------
// getLayeredXMLNode()
//-----------------------------------------------------------------------------
bool LLUICtrlFactory::getLayeredXMLNode(const std::string &xui_filename, LLXMLNodePtr& root,
                                        LLDir::ESkinConstraint constraint)
{
	LL_RECORD_BLOCK_TIME(FTM_XML_PARSE);
	std::vector<std::string> paths =
		gDirUtilp->findSkinnedFilenames(LLDir::XUI, xui_filename, constraint);

	if (paths.empty())
	{
		// sometimes whole path is passed in as filename
		paths.push_back(xui_filename);
	}

	return LLXMLNode::getLayeredXMLNode(root, paths);
}
Пример #19
0
//static
void LLDrawPoolBump::renderBump(U32 pass)
{
	if (!gPipeline.hasRenderBatches(pass))
	{
		return;
	}

	LL_RECORD_BLOCK_TIME(FTM_RENDER_BUMP);
	LLGLDisable fog(GL_FOG);
	LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_LEQUAL);
	LLGLEnable blend(GL_BLEND);
	gGL.diffuseColor4f(1,1,1,1);
	/// Get rid of z-fighting with non-bump pass.
	LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
	glPolygonOffset(-1.0f, -1.0f);
	renderBump(pass, sVertexMask);
}
Пример #20
0
void LLDrawPoolWLSky::renderDeferred(S32 pass)
{
	if (!gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))
	{
		return;
	}
	LL_RECORD_BLOCK_TIME(FTM_RENDER_WL_SKY);

	const F32 camHeightLocal = LLWLParamManager::getInstance()->getDomeOffset() * LLWLParamManager::getInstance()->getDomeRadius();

	LLGLSNoFog disableFog;
	LLGLDepthTest depth(GL_TRUE, GL_FALSE);
	LLGLDisable clip(GL_CLIP_PLANE0);

	gGL.setColorMask(true, false);

	LLGLSquashToFarClip far_clip(glh_get_current_projection());

	renderSkyHaze(camHeightLocal);

	LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
	gGL.pushMatrix();

		
		gGL.translatef(origin.mV[0], origin.mV[1], origin.mV[2]);

		gDeferredStarProgram.bind();
		// *NOTE: have to bind a texture here since register combiners blending in
		// renderStars() requires something to be bound and we might as well only
		// bind the moon's texture once.		
		gGL.getTexUnit(0)->bind(gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON]->getTexture());

		renderHeavenlyBodies();

		renderStars();
		
		gDeferredStarProgram.unbind();

	gGL.popMatrix();

	renderSkyClouds(camHeightLocal);

	gGL.setColorMask(true, true);
	//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);

}
Пример #21
0
void LLDrawPoolBump::endShiny(bool invisible)
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY);
	if ((!invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_SHINY))|| 
		(invisible && !gPipeline.hasRenderBatches(LLRenderPass::PASS_INVISI_SHINY)))
	{
		return;
	}

	unbindCubeMap(shader, mVertexShaderLevel, diffuse_channel, cube_channel, invisible);
	if (shader)
	{
		shader->unbind();
	}

	diffuse_channel = -1;
	cube_channel = 0;
	mShiny = FALSE;
}
void LLWLParamManager::update(LLViewerCamera * cam)
{
	LL_RECORD_BLOCK_TIME(FTM_UPDATE_WLPARAM);
	
	// update clouds, sun, and general
	mCurParams.updateCloudScrolling();
	
	// update only if running
	if(mAnimator.getIsRunning()) 
	{
		mAnimator.update(mCurParams);
	}

	// update the shaders and the menu
	propagateParameters();
	
	F32 camYaw = cam->getYaw();

	stop_glerror();

	// *TODO: potential optimization - this block may only need to be
	// executed some of the time.  For example for water shaders only.
	{
		F32 camYawDelta = mSunDeltaYaw * DEG_TO_RAD;
		
		LLVector3 lightNorm3(mLightDir);
		lightNorm3 *= LLQuaternion(-(camYaw + camYawDelta), LLVector3(0.f, 1.f, 0.f));
		mRotatedLightDir = LLVector4(lightNorm3, 0.f);

		LLViewerShaderMgr::shader_iter shaders_iter, end_shaders;
		end_shaders = LLViewerShaderMgr::instance()->endShaders();
		for(shaders_iter = LLViewerShaderMgr::instance()->beginShaders(); shaders_iter != end_shaders; ++shaders_iter)
		{
			if (shaders_iter->mProgramObject != 0
				&& (gPipeline.canUseWindLightShaders()
				|| shaders_iter->mShaderGroup == LLGLSLShader::SG_WATER))
			{
				shaders_iter->mUniformsDirty = TRUE;
			}
		}
	}
}
Пример #23
0
//static
void LLDrawPoolBump::beginShiny(bool invisible)
{
	LL_RECORD_BLOCK_TIME(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 (getVertexShaderLevel() > 0)
	{
		if (LLPipeline::sUnderWaterRender)
		{
			shader = &gObjectShinyWaterProgram;
		}
		else
		{
			shader = &gObjectShinyProgram;
		}
		shader->bind();
	}
	else
	{
		shader = NULL;
	}

	bindCubeMap(shader, mVertexShaderLevel, diffuse_channel, cube_channel, invisible);

	if (mVertexShaderLevel > 1)
	{ //indexed texture rendering, channel 0 is always diffuse
		diffuse_channel = 0;
	}
}
void LLMaterialMgr::onIdle(void*)
{
	LL_RECORD_BLOCK_TIME(FTM_MATERIALS_IDLE);

	LLMaterialMgr* instancep = LLMaterialMgr::getInstance();

	if (!instancep->mGetQueue.empty())
	{
		instancep->processGetQueue();
	}

	if (!instancep->mGetAllQueue.empty())
	{
		instancep->processGetAllQueue();
	}

	if (!instancep->mPutQueue.empty())
	{
		instancep->processPutQueue();
	}
}
Пример #25
0
void LLParticlePartition::rebuildGeom(LLSpatialGroup* group)
{
	if (group->isDead() || !group->hasState(LLSpatialGroup::GEOM_DIRTY))
	{
		return;
	}

	if (group->changeLOD())
	{
		group->mLastUpdateDistance = group->mDistance;
		group->mLastUpdateViewAngle = group->mViewAngle;
	}
	
	LL_RECORD_BLOCK_TIME(FTM_REBUILD_PARTICLE_VBO);	

	group->clearDrawMap();
	
	//get geometry count
	U32 index_count = 0;
	U32 vertex_count = 0;

	addGeometryCount(group, vertex_count, index_count);
	

	if (vertex_count > 0 && index_count > 0)
	{ 
		group->mBuilt = 1.f;
		//use one vertex buffer for all groups
		group->mVertexBuffer = LLVOPartGroup::sVB;
		getGeometry(group);
	}
	else
	{
		group->mVertexBuffer = NULL;
		group->mBufferMap.clear();
	}

	group->mLastUpdateTime = gFrameTimeSeconds;
	group->clearState(LLSpatialGroup::GEOM_DIRTY);
}
void LLTerrainPartition::getGeometry(LLSpatialGroup* group)
{
	LL_RECORD_BLOCK_TIME(FTM_REBUILD_TERRAIN_VB);

	LLVertexBuffer* buffer = group->mVertexBuffer;

	//get vertex buffer striders
	LLStrider<LLVector3> vertices;
	LLStrider<LLVector3> normals;
	LLStrider<LLVector2> texcoords2;
	LLStrider<LLVector2> texcoords;
	LLStrider<U16> indices;

	llassert_always(buffer->getVertexStrider(vertices));
	llassert_always(buffer->getNormalStrider(normals));
	llassert_always(buffer->getTexCoord0Strider(texcoords));
	llassert_always(buffer->getTexCoord1Strider(texcoords2));
	llassert_always(buffer->getIndexStrider(indices));

	U32 indices_index = 0;
	U32 index_offset = 0;

	for (std::vector<LLFace*>::iterator i = mFaceList.begin(); i != mFaceList.end(); ++i)
	{
		LLFace* facep = *i;

		facep->setIndicesIndex(indices_index);
		facep->setGeomIndex(index_offset);
		facep->setVertexBuffer(buffer);

		LLVOSurfacePatch* patchp = (LLVOSurfacePatch*) facep->getViewerObject();
		patchp->getGeometry(vertices, normals, texcoords, texcoords2, indices);

		indices_index += facep->getIndicesCount();
		index_offset += facep->getGeomCount();
	}

	buffer->flush();
	mFaceList.clear();
}
Пример #27
0
void LLDrawPoolBump::renderFullbrightShiny()
{
	LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY);
	if (!gPipeline.hasRenderBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY))
	{
		return;
	}

	if( gSky.mVOSkyp->getCubeMap() )
	{
		LLGLEnable blend_enable(GL_BLEND);

		if (mVertexShaderLevel > 1)
		{
			LLRenderPass::pushBatches(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE);
		}
		else
		{
			LLRenderPass::renderTexture(LLRenderPass::PASS_FULLBRIGHT_SHINY, sVertexMask);
		}
	}
}
void LLPolySkeletalDistortion::apply( ESex avatar_sex )
{
	LL_RECORD_BLOCK_TIME(FTM_POLYSKELETAL_DISTORTION_APPLY);

        F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();

        LLJoint* joint;
        joint_vec_map_t::iterator iter;

	for (iter = mJointScales.begin();
		 iter != mJointScales.end();
		 iter++)
	{
		joint = iter->first;
		LLVector3 newScale = joint->getScale();
		LLVector3 scaleDelta = iter->second;
		newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta);
				//An aspect of attached mesh objects (which contain joint offsets) that need to be cleaned up when detached
				// needed? // joint->storeScaleForReset( newScale );				
		joint->setScale(newScale);
	}

	for (iter = mJointOffsets.begin();
		 iter != mJointOffsets.end();
		 iter++)
	{
		joint = iter->first;
		LLVector3 newPosition = joint->getPosition();
		LLVector3 positionDelta = iter->second;
		newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
		joint->setPosition(newPosition);
	}

	if (mLastWeight != mCurWeight && !mIsAnimating)
	{
		mAvatar->setSkeletonSerialNum(mAvatar->getSkeletonSerialNum() + 1);
	}
	mLastWeight = mCurWeight;
}
// Items and folders that are on the clipboard or, recursively, in a folder which  
// is on the clipboard must be filtered out if the clipboard is in the "cut" mode.
bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const
{
	if (LLClipboard::instance().isCutMode())
	{
		LL_RECORD_BLOCK_TIME(FT_FILTER_CLIPBOARD);
		LLUUID current_id = object_id;
		LLInventoryObject *current_object = gInventory.getObject(object_id);
		while (current_id.notNull() && current_object)
		{
			if (LLClipboard::instance().isOnClipboard(current_id))
			{
				return false;
			}
			current_id = current_object->getParentUUID();
			if (current_id.notNull())
			{
				current_object = gInventory.getObject(current_id);
			}
		}
	}
	return true;
}
Пример #30
0
//static 
void LLUICtrlFactory::createChildren(LLView* viewp, LLXMLNodePtr node, const widget_registry_t& registry, LLXMLNodePtr output_node)
{
	LL_RECORD_BLOCK_TIME(FTM_CREATE_CHILDREN);
	if (node.isNull()) return;

	for (LLXMLNodePtr child_node = node->getFirstChild(); child_node.notNull(); child_node = child_node->getNextSibling())
	{
		LLXMLNodePtr outputChild;
		if (output_node) 
		{
			outputChild = output_node->createChild("", FALSE);
		}

		if (!instance().createFromXML(child_node, viewp, LLStringUtil::null, registry, outputChild))
		{
			// child_node is not a valid child for the current parent
			std::string child_name = std::string(child_node->getName()->mString);
			if (LLDefaultChildRegistry::instance().getValue(child_name))
			{
				// This means that the registry assocaited with the parent widget does not have an entry
				// for the child widget
				// You might need to add something like:
				// static ParentWidgetRegistry::Register<ChildWidgetType> register("child_widget_name");
				LL_WARNS() << child_name << " is not a valid child of " << node->getName()->mString << LL_ENDL;
			}
			else
			{
				LL_WARNS() << "Could not create widget named " << child_node->getName()->mString << LL_ENDL;
			}
		}

		if (outputChild && !outputChild->mChildren && outputChild->mAttributes.empty() && outputChild->getValue().empty())
		{
			output_node->deleteChild(outputChild);
		}
	}

}