本文整理汇总了C++中LLVOSky::isReflFace方法的典型用法代码示例。如果您正苦于以下问题:C++ LLVOSky::isReflFace方法的具体用法?C++ LLVOSky::isReflFace怎么用?C++ LLVOSky::isReflFace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLVOSky
的用法示例。
在下文中一共展示了LLVOSky::isReflFace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shade
//.........这里部分代码省略.........
shader->uniform1f("fresnelOffset", param_mgr->getFresnelOffset());
shader->uniform1f("blurMultiplier", param_mgr->getBlurMultiplier());
F32 sunAngle = llmax(0.f, light_dir.mV[2]);
F32 scaledAngle = 1.f - sunAngle;
shader->uniform1f("sunAngle", sunAngle);
shader->uniform1f("scaledAngle", scaledAngle);
shader->uniform1f("sunAngle2", 0.1f + 0.2f*sunAngle);
LLColor4 water_color;
LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis();
F32 up_dot = camera_up * LLVector3::z_axis;
if (LLViewerCamera::getInstance()->cameraUnderWater())
{
water_color.setVec(1.f, 1.f, 1.f, 0.4f);
shader->uniform1f(LLViewerShaderMgr::WATER_REFSCALE, param_mgr->getScaleBelow());
}
else
{
water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot));
shader->uniform1f(LLViewerShaderMgr::WATER_REFSCALE, param_mgr->getScaleAbove());
}
if (water_color.mV[3] > 0.9f)
{
water_color.mV[3] = 0.9f;
}
glColor4fv(water_color.mV);
{
LLGLDisable cullface(GL_CULL_FACE);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace *face = *iter;
if (voskyp->isReflFace(face))
{
continue;
}
LLVOWater* water = (LLVOWater*) face->getViewerObject();
gGL.getTexUnit(diffTex)->bind(face->getTexture());
sNeedsReflectionUpdate = TRUE;
if (water->getUseTexture())
{
sNeedsDistortionUpdate = TRUE;
face->renderIndexed();
}
else
{ //smash background faces to far clip plane
if (water->getIsEdgePatch())
{
if (deferred_render)
{
face->renderIndexed();
}
else
{
LLGLClampToFarClip far_clip(glh_get_current_projection());
face->renderIndexed();
}
}
else
{
sNeedsDistortionUpdate = TRUE;
face->renderIndexed();
}
}
}
}
shader->disableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
shader->disableTexture(LLViewerShaderMgr::WATER_SCREENTEX);
shader->disableTexture(LLViewerShaderMgr::BUMP_MAP);
shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
shader->disableTexture(LLViewerShaderMgr::WATER_REFTEX);
shader->disableTexture(LLViewerShaderMgr::WATER_SCREENDEPTH);
if (deferred_render)
{
gPipeline.unbindDeferredShader(*shader);
}
else
{
shader->unbind();
}
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
if (!deferred_render)
{
gGL.setColorMask(true, false);
}
}
示例2: renderOpaqueLegacyWater
// for low end hardware
void LLDrawPoolWater::renderOpaqueLegacyWater()
{
LLVOSky *voskyp = gSky.mVOSkyp;
stop_glerror();
// Depth sorting and write to depth buffer
// since this is opaque, we should see nothing
// behind the water. No blending because
// of no transparency. And no face culling so
// that the underside of the water is also opaque.
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
LLGLDisable no_cull(GL_CULL_FACE);
LLGLDisable no_blend(GL_BLEND);
gPipeline.disableLights();
mOpaqueWaterImagep->addTextureStats(1024.f*1024.f);
// Activate the texture binding and bind one
// texture since all images will have the same texture
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(0)->bind(mOpaqueWaterImagep);
// Automatically generate texture coords for water texture
glEnable(GL_TEXTURE_GEN_S); //texture unit 0
glEnable(GL_TEXTURE_GEN_T); //texture unit 0
glTexGenf(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenf(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
// Use the fact that we know all water faces are the same size
// to save some computation
// Slowly move texture coordinates over time so the watter appears
// to be moving.
F32 movement_period_secs = 50.f;
F32 offset = fmod(gFrameTimeSeconds, movement_period_secs);
if (movement_period_secs != 0)
{
offset /= movement_period_secs;
}
else
{
offset = 0;
}
F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset };
F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset };
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
glColor3f(1.f, 1.f, 1.f);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace *face = *iter;
if (voskyp->isReflFace(face))
{
continue;
}
face->renderIndexed();
}
stop_glerror();
// Reset the settings back to expected values
glDisable(GL_TEXTURE_GEN_S); //texture unit 0
glDisable(GL_TEXTURE_GEN_T); //texture unit 0
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
示例3: render
void LLDrawPoolWater::render(S32 pass)
{
LLFastTimer ftm(FTM_RENDER_WATER);
if (mDrawFace.empty() || LLDrawable::getCurrentFrame() <= 1)
{
return;
}
//do a quick 'n dirty depth sort
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace* facep = *iter;
facep->mDistance = -facep->mCenterLocal.mV[2];
}
std::sort(mDrawFace.begin(), mDrawFace.end(), LLFace::CompareDistanceGreater());
LLGLEnable blend(GL_BLEND);
if ((mVertexShaderLevel > 0) && !sSkipScreenCopy)
{
shade();
return;
}
LLVOSky *voskyp = gSky.mVOSkyp;
stop_glerror();
if (!gGLManager.mHasMultitexture)
{
// Ack! No multitexture! Bail!
return;
}
LLFace* refl_face = voskyp->getReflFace();
gPipeline.disableLights();
LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
LLGLDisable cullFace(GL_CULL_FACE);
// Set up second pass first
mWaterImagep->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(1)->activate();
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->bind(mWaterImagep) ;
LLVector3 camera_up = LLViewerCamera::getInstance()->getUpAxis();
F32 up_dot = camera_up * LLVector3::z_axis;
LLColor4 water_color;
if (LLViewerCamera::getInstance()->cameraUnderWater())
{
water_color.setVec(1.f, 1.f, 1.f, 0.4f);
}
else
{
water_color.setVec(1.f, 1.f, 1.f, 0.5f*(1.f + up_dot));
}
glColor4fv(water_color.mV);
// Automatically generate texture coords for detail map
glEnable(GL_TEXTURE_GEN_S); //texture unit 1
glEnable(GL_TEXTURE_GEN_T); //texture unit 1
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
// Slowly move over time.
F32 offset = fmod(gFrameTimeSeconds*2.f, 100.f);
F32 tp0[4] = {16.f/256.f, 0.0f, 0.0f, offset*0.01f};
F32 tp1[4] = {0.0f, 16.f/256.f, 0.0f, offset*0.01f};
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA);
gGL.getTexUnit(0)->activate();
glClearStencil(1);
glClear(GL_STENCIL_BUFFER_BIT);
LLGLEnable gls_stencil(GL_STENCIL_TEST);
glStencilOp(GL_KEEP, GL_REPLACE, GL_KEEP);
glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace *face = *iter;
if (voskyp->isReflFace(face))
{
continue;
}
gGL.getTexUnit(0)->bind(face->getTexture());
face->renderIndexed();
}
//.........这里部分代码省略.........
示例4: renderOpaqueLegacyWater
//.........这里部分代码省略.........
// however it works well enough otherwise, and is much cleaner than diving into LLTextureList, LLViewerFetchedTexture, and LLViewerTexture.
// Perhaps a proper reload mechanism could be done if we ever add user-level texture reloading, but until then it's not a huge priority.
// Failing to fully refetch will just give us the same invalid texture we started with, which will result in the fallback texture being used.
if(mOpaqueWaterImagep != mWaterImagep)
{
if(mOpaqueWaterImagep->isMissingAsset())
{
mOpaqueWaterImagep = mWaterImagep;
}
else if(mOpaqueWaterImagep->hasGLTexture() && mOpaqueWaterImagep->getComponents() < 3)
{
LLAppViewer::getTextureCache()->removeFromCache(mOpaqueWaterImagep->getID());
static bool sRefetch = true;
if(sRefetch)
{
sRefetch = false;
((LLViewerFetchedTexture*)mOpaqueWaterImagep.get())->forceRefetch();
}
else
mOpaqueWaterImagep = mWaterImagep;
}
}
mOpaqueWaterImagep->addTextureStats(1024.f*1024.f);
// Activate the texture binding and bind one
// texture since all images will have the same texture
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(0)->bind(mOpaqueWaterImagep);
// Automatically generate texture coords for water texture
if (!shader)
{
glEnable(GL_TEXTURE_GEN_S); //texture unit 0
glEnable(GL_TEXTURE_GEN_T); //texture unit 0
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
}
// Use the fact that we know all water faces are the same size
// to save some computation
// Slowly move texture coordinates over time so the water appears
// to be moving.
F32 movement_period_secs = 50.f;
static const LLCachedControl<bool> freeze_time("FreezeTime",false);
static F32 frame_time;
if (!freeze_time) frame_time = gFrameTimeSeconds;
F32 offset = fmod(frame_time, movement_period_secs);
if (movement_period_secs != 0)
{
offset /= movement_period_secs;
}
else
{
offset = 0;
}
F32 tp0[4] = { 16.f / 256.f, 0.0f, 0.0f, offset };
F32 tp1[4] = { 0.0f, 16.f / 256.f, 0.0f, offset };
if (!shader)
{
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1);
}
else
{
shader->uniform4fv("object_plane_s", 1, tp0);
shader->uniform4fv("object_plane_t", 1, tp1);
}
gGL.diffuseColor3f(1.f, 1.f, 1.f);
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace *face = *iter;
if (voskyp->isReflFace(face))
{
continue;
}
face->renderIndexed();
}
stop_glerror();
if (!shader)
{
// Reset the settings back to expected values
glDisable(GL_TEXTURE_GEN_S); //texture unit 0
glDisable(GL_TEXTURE_GEN_T); //texture unit 0
}
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}