本文整理汇总了C++中LLDrawPoolAvatar类的典型用法代码示例。如果您正苦于以下问题:C++ LLDrawPoolAvatar类的具体用法?C++ LLDrawPoolAvatar怎么用?C++ LLDrawPoolAvatar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLDrawPoolAvatar类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glMatrixMode
//-----------------------------------------------------------------------------
// update()
//-----------------------------------------------------------------------------
BOOL LLImagePreviewAvatar::render()
{
mNeedsUpdate = FALSE;
LLVOAvatar* avatarp = mDummyAvatar;
glMatrixMode(GL_PROJECTION);
gGL.pushMatrix();
glLoadIdentity();
glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
gGL.pushMatrix();
glLoadIdentity();
LLGLSUIDefault def;
gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
gl_rect_2d_simple( mWidth, mHeight );
glMatrixMode(GL_PROJECTION);
gGL.popMatrix();
glMatrixMode(GL_MODELVIEW);
gGL.popMatrix();
gGL.flush();
LLVector3 target_pos = mTargetJoint->getWorldPosition();
LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
LLQuaternion(mCameraYaw, LLVector3::z_axis);
LLQuaternion av_rot = avatarp->mPelvisp->getWorldRotation() * camera_rot;
LLViewerCamera::getInstance()->setOriginAndLookAt(
target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera
LLVector3::z_axis, // up
target_pos + (mCameraOffset * av_rot) ); // point of interest
stop_glerror();
LLViewerCamera::getInstance()->setAspect((F32)mWidth / mHeight);
LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE);
LLVertexBuffer::unbind();
avatarp->updateLOD();
if (avatarp->mDrawable.notNull())
{
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
// make sure alpha=0 shows avatar material color
LLGLDisable no_blend(GL_BLEND);
LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool();
avatarPoolp->renderAvatars(avatarp); // renders only one avatar
}
gGL.color4f(1,1,1,1);
return TRUE;
}
示例2: glMatrixMode
//-----------------------------------------------------------------------------
// render()
//-----------------------------------------------------------------------------
BOOL LLVisualParamHint::render()
{
LLVisualParamReset::sDirty = TRUE;
LLVOAvatar* avatarp = gAgent.getAvatarObject();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
LLGLSUIDefault gls_ui;
//LLGLState::verify(TRUE);
mBackgroundp->draw(0, 0, mWidth, mHeight);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
mNeedsUpdate = FALSE;
mIsVisible = TRUE;
LLViewerJointMesh* cam_target_joint = NULL;
const std::string& cam_target_mesh_name = mVisualParam->getCameraTargetName();
if( !cam_target_mesh_name.empty() )
{
cam_target_joint = (LLViewerJointMesh*)avatarp->getJoint( cam_target_mesh_name );
}
if( !cam_target_joint )
{
cam_target_joint = (LLViewerJointMesh*)gMorphView->getCameraTargetJoint();
}
if( !cam_target_joint )
{
cam_target_joint = (LLViewerJointMesh*)avatarp->getJoint("mHead");
}
LLQuaternion avatar_rotation;
LLJoint* root_joint = avatarp->getRootJoint();
if( root_joint )
{
avatar_rotation = root_joint->getWorldRotation();
}
LLVector3 target_joint_pos = cam_target_joint->getWorldPosition();
LLVector3 target_offset( 0, 0, mVisualParam->getCameraElevation() );
LLVector3 target_pos = target_joint_pos + (target_offset * avatar_rotation);
F32 cam_angle_radians = mVisualParam->getCameraAngle() * DEG_TO_RAD;
LLVector3 camera_snapshot_offset(
mVisualParam->getCameraDistance() * cosf( cam_angle_radians ),
mVisualParam->getCameraDistance() * sinf( cam_angle_radians ),
mVisualParam->getCameraElevation() );
LLVector3 camera_pos = target_joint_pos + (camera_snapshot_offset * avatar_rotation);
gGL.flush();
LLViewerCamera::getInstance()->setAspect((F32)mWidth / (F32)mHeight);
LLViewerCamera::getInstance()->setOriginAndLookAt(
camera_pos, // camera
LLVector3(0.f, 0.f, 1.f), // up
target_pos ); // point of interest
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mWidth, mHeight, FALSE);
if (avatarp->mDrawable.notNull())
{
LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool();
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
gGL.setAlphaRejectSettings(LLRender::CF_ALWAYS);
gGL.setSceneBlendType(LLRender::BT_REPLACE);
avatarPoolp->renderAvatars(avatarp); // renders only one avatar
gGL.setSceneBlendType(LLRender::BT_ALPHA);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
avatarp->setVisualParamWeight(mVisualParam, mLastParamWeight);
gGL.color4f(1,1,1,1);
mTexture->setGLTextureCreated(true);
return TRUE;
}
示例3: target_offset
//-----------------------------------------------------------------------------
// render()
//-----------------------------------------------------------------------------
BOOL LLVisualParamHint::render()
{
LLVisualParamReset::sDirty = TRUE;
gGL.pushUIMatrix();
gGL.loadUIIdentity();
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
gGL.loadIdentity();
gGL.ortho(0.0f, mFullWidth, 0.0f, mFullHeight, -1.0f, 1.0f);
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix();
gGL.loadIdentity();
if (LLGLSLShader::sNoFixedFunction)
{
gUIProgram.bind();
}
LLGLSUIDefault gls_ui;
//LLGLState::verify(TRUE);
mBackgroundp->draw(0, 0, mFullWidth, mFullHeight);
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
mNeedsUpdate = FALSE;
mIsVisible = TRUE;
LLQuaternion avatar_rotation;
LLJoint* root_joint = gAgentAvatarp->getRootJoint();
if( root_joint )
{
avatar_rotation = root_joint->getWorldRotation();
}
LLVector3 target_joint_pos = mCamTargetJoint->getWorldPosition();
LLVector3 target_offset( 0, 0, mVisualParam->getCameraElevation() );
LLVector3 target_pos = target_joint_pos + (target_offset * avatar_rotation);
F32 cam_angle_radians = mVisualParam->getCameraAngle() * DEG_TO_RAD;
LLVector3 camera_snapshot_offset(
mVisualParam->getCameraDistance() * cosf( cam_angle_radians ),
mVisualParam->getCameraDistance() * sinf( cam_angle_radians ),
mVisualParam->getCameraElevation() );
LLVector3 camera_pos = target_joint_pos + (camera_snapshot_offset * avatar_rotation);
gGL.flush();
LLViewerCamera::getInstance()->setAspect((F32)mFullWidth / (F32)mFullHeight);
LLViewerCamera::getInstance()->setOriginAndLookAt(
camera_pos, // camera
LLVector3::z_axis, // up
target_pos ); // point of interest
LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
if (gAgentAvatarp->mDrawable.notNull() &&
gAgentAvatarp->mDrawable->getFace(0))
{
LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)gAgentAvatarp->mDrawable->getFace(0)->getPool();
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
gGL.setAlphaRejectSettings(LLRender::CF_ALWAYS);
gGL.setSceneBlendType(LLRender::BT_REPLACE);
avatarPoolp->renderAvatars(gAgentAvatarp); // renders only one avatar
gGL.setSceneBlendType(LLRender::BT_ALPHA);
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight, FALSE);
gAgentAvatarp->updateVisualParams();
gGL.color4f(1,1,1,1);
mGLTexturep->setGLTextureCreated(true);
gGL.popUIMatrix();
return TRUE;
}