本文整理汇总了C++中StateSet::getOrCreateUniform方法的典型用法代码示例。如果您正苦于以下问题:C++ StateSet::getOrCreateUniform方法的具体用法?C++ StateSet::getOrCreateUniform怎么用?C++ StateSet::getOrCreateUniform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StateSet
的用法示例。
在下文中一共展示了StateSet::getOrCreateUniform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateVSParameters
/***************************************************************
* Function: updateVSParameters()
***************************************************************/
void DSVirtualEarth::updateVSParameters(const Vec3 &viewDir, const Vec3 &viewPos)
{
if (!mVirtualScenicHandler) return;
/* compute sun direction in world space: apply transforms resulted by viewer's orientation change,
guarantee that from the viewer's position, the virtual earth is always half illuminated. */
Matrixd baserotMat;
baserotMat.makeRotate(Vec3(0, 1, 0), gDesignStateFrontVect);
Vec3 sunDirWorld = (CAVEAnimationModeler::ANIMVirtualEarthLightDir()) * baserotMat;
StateSet *stateset = mEarthGeode->getStateSet();
if (stateset)
{
Uniform *lightposUniform = stateset->getOrCreateUniform("LightPos", Uniform::FLOAT_VEC4);
lightposUniform->set(Vec4(sunDirWorld, 0.0));
}
/* compute matrix combination that transforms a vector from shader space into world space */
Matrixd latiMat;
latiMat.makeRotate(mLati / 180.f * M_PI, Vec3(0, 1, 0));
Matrixd equatorMat;
equatorMat.makeRotate((mTimeOffset / 12.f + mLongi / 180.f) * M_PI, Vec3(0, 0, 1));
Matrixd tiltaxisMat = mTiltAxisTrans->getMatrix();
Matrixd eclipticMat = mEclipticTrans->getMatrix();
Matrixd transMat = mUnitspaceMat * latiMat * equatorMat * tiltaxisMat * eclipticMat * baserotMat;
/* updata environment rendering by passing parameters to VirtualScenicHandler */
mVirtualScenicHandler->updateVSParameters(transMat, sunDirWorld, viewDir, viewPos);
}