BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate) { BOOL lod_changed = FALSE; BOOL found_lod = FALSE; for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter); F32 jointLOD = joint->getLOD(); if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD) { // we've already found a joint to enable, so enable the rest as alternatives lod_changed |= joint->updateLOD(pixel_area, TRUE); } else { if (pixel_area >= jointLOD || sDisableLOD) { lod_changed |= joint->updateLOD(pixel_area, TRUE); found_lod = TRUE; } else { lod_changed |= joint->updateLOD(pixel_area, FALSE); } } } return lod_changed; }
void LLAvatarJoint::dump() { for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter); joint->dump(); } }
void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update) { for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter); joint->updateFaceData(face, pixel_area, damp_wind, terse_update); } }
void LLAvatarJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area) { for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter); joint->updateFaceSizes(num_vertices, num_indices, pixel_area); } }
void LLAvatarJoint::updateJointGeometry() { for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter); if (joint) joint->updateJointGeometry(); } }
//-------------------------------------------------------------------- // setSkeletonComponents() //-------------------------------------------------------------------- void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive ) { mComponents = comp; if (recursive) { for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter); joint->setSkeletonComponents(comp, recursive); } } }
void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive) { mVisible = visible; if (recursive) { for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLAvatarJoint* joint = (LLAvatarJoint*)(*iter); joint->setVisible(visible, recursive); } } }
//----------------------------------------------------------------------------- // setupJoint() //----------------------------------------------------------------------------- void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint) { // llinfos << "Mesh: " << getName() << llendl; // S32 joint_count = 0; U32 sj; for (sj=0; sj<mNumSkinJoints; sj++) { LLSkinJoint &js = mSkinJoints[sj]; if (js.mJoint != current_joint) { continue; } // we've found a skinjoint for this joint.. // is the last joint in the array our parent? if(mMesh->mJointRenderData.count() && mMesh->mJointRenderData[mMesh->mJointRenderData.count() - 1]->mWorldMatrix == ¤t_joint->getParent()->getWorldMatrix()) { // ...then just add ourselves LLAvatarJoint* jointp = js.mJoint; mMesh->mJointRenderData.put(new LLJointRenderData(&jointp->getWorldMatrix(), &js)); // llinfos << "joint " << joint_count << js.mJoint->getName() << llendl; // joint_count++; } // otherwise add our parent and ourselves else { mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getParent()->getWorldMatrix(), NULL)); // llinfos << "joint " << joint_count << current_joint->getParent()->getName() << llendl; // joint_count++; mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getWorldMatrix(), &js)); // llinfos << "joint " << joint_count << current_joint->getName() << llendl; // joint_count++; } } // depth-first traversal for (LLJoint::child_list_t::iterator iter = current_joint->mChildren.begin(); iter != current_joint->mChildren.end(); ++iter) { LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter); setupJoint(child_joint); } }
//-------------------------------------------------------------------- // setValid() //-------------------------------------------------------------------- void LLAvatarJoint::setValid( BOOL valid, BOOL recursive ) { //---------------------------------------------------------------- // set visibility for this joint //---------------------------------------------------------------- mValid = valid; //---------------------------------------------------------------- // set visibility for children //---------------------------------------------------------------- if (recursive) { for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLAvatarJoint* joint = (LLAvatarJoint*)(*iter); joint->setValid(valid, TRUE); } } }
//-------------------------------------------------------------------- // render() //-------------------------------------------------------------------- U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy ) { stop_glerror(); U32 triangle_count = 0; //---------------------------------------------------------------- // ignore invisible objects //---------------------------------------------------------------- if ( mValid ) { //---------------------------------------------------------------- // if object is transparent, defer it, otherwise // give the joint subclass a chance to draw itself //---------------------------------------------------------------- if ( is_dummy ) { triangle_count += drawShape( pixelArea, first_pass, is_dummy ); } else if (LLPipeline::sShadowRender) { triangle_count += drawShape(pixelArea, first_pass, is_dummy ); } else if ( isTransparent() && !LLPipeline::sReflectionRender) { // Hair and Skirt if ((pixelArea > MIN_PIXEL_AREA_3PASS_HAIR)) { // render all three passes LLGLDisable cull(GL_CULL_FACE); // first pass renders without writing to the z buffer { LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); triangle_count += drawShape( pixelArea, first_pass, is_dummy ); } // second pass writes to z buffer only gGL.setColorMask(false, false); { triangle_count += drawShape( pixelArea, FALSE, is_dummy ); } // third past respects z buffer and writes color gGL.setColorMask(true, false); { LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); triangle_count += drawShape( pixelArea, FALSE, is_dummy ); } } else { // Render Inside (no Z buffer write) glCullFace(GL_FRONT); { LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); triangle_count += drawShape( pixelArea, first_pass, is_dummy ); } // Render Outside (write to the Z buffer) glCullFace(GL_BACK); { triangle_count += drawShape( pixelArea, FALSE, is_dummy ); } } } else { // set up render state triangle_count += drawShape( pixelArea, first_pass ); } } //---------------------------------------------------------------- // render children //---------------------------------------------------------------- for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter); if (!joint) continue; F32 jointLOD = joint->getLOD(); if (pixelArea >= jointLOD || sDisableLOD) { triangle_count += joint->render( pixelArea, TRUE, is_dummy ); if (jointLOD != DEFAULT_AVATAR_JOINT_LOD) { break; } } } return triangle_count; }