本文整理汇总了C++中LLVolume类的典型用法代码示例。如果您正苦于以下问题:C++ LLVolume类的具体用法?C++ LLVolume怎么用?C++ LLVolume使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLVolume类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: t
void LLDrawPoolAvatar::updateRiggedVertexBuffers(LLVOAvatar* avatar)
{
LLFastTimer t(FTM_RIGGED_VBO);
//update rigged vertex buffers
for (U32 type = 0; type < NUM_RIGGED_PASSES; ++type)
{
for (U32 i = 0; i < mRiggedFace[type].size(); ++i)
{
LLFace* face = mRiggedFace[type][i];
LLDrawable* drawable = face->getDrawable();
if (!drawable)
{
continue;
}
LLVOVolume* vobj = drawable->getVOVolume();
if (!vobj)
{
continue;
}
LLVolume* volume = vobj->getVolume();
S32 te = face->getTEOffset();
if (!volume || volume->getNumVolumeFaces() <= te)
{
continue;
}
LLUUID mesh_id = volume->getParams().getSculptID();
if (mesh_id.isNull())
{
continue;
}
const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, vobj);
if (!skin)
{
continue;
}
stop_glerror();
const LLVolumeFace& vol_face = volume->getVolumeFace(te);
updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face);
}
}
}
示例2: performSculptUpdates
void LLLocalBitmapBrowser::performSculptUpdates(LLLocalBitmap* unit)
{
/* looking for sculptmap using objects only */
std::vector<LLAffectedObject> object_list = unit->getUsingObjects(false, false, true);
if (object_list.empty()) { return; }
for( std::vector<LLAffectedObject>::iterator iter = object_list.begin();
iter != object_list.end(); iter++ )
{
LLAffectedObject aobj = *iter;
if ( aobj.object )
{
if ( !aobj.local_sculptmap ) { continue; } // should never get here. only in case of misuse.
// update code [begin]
if ( unit->mVolumeDirty )
{
LLImageRaw* rawimage = gTextureList.findImage( unit->getID() )->getCachedRawImage();
LLVolumeParams params = aobj.object->getVolume()->getParams();
LLVolumeLODGroup* lodgroup = aobj.object->mDrawable->getVOVolume()->getVolumeManager()->getGroup(params);
for (S32 i = 0; i < LLVolumeLODGroup::NUM_LODS; i++)
{
LLVolume* vol = lodgroup->getVolByLOD(i);
if (vol)
{ vol->sculpt(rawimage->getWidth(), rawimage->getHeight(), rawimage->getComponents(), rawimage->getData(), 0); }
}
// doing this again to fix the weirdness with selected-for-edit objects not updating otherwise.
aobj.object->getVolume()->sculpt(rawimage->getWidth(), rawimage->getHeight(),
rawimage->getComponents(), rawimage->getData(), 0);
unit->mVolumeDirty = false;
}
aobj.object->mDrawable->getVOVolume()->setSculptChanged( true );
aobj.object->mDrawable->getVOVolume()->markForUpdate( true );
// update code [end]
}
}
}
示例3: stop_glerror
void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
{
if (avatar->isSelf() && !gAgent.needsRenderAvatar() || !gMeshRepo.meshRezEnabled())
{
return;
}
stop_glerror();
for (U32 i = 0; i < mRiggedFace[type].size(); ++i)
{
LLFace* face = mRiggedFace[type][i];
LLDrawable* drawable = face->getDrawable();
if (!drawable)
{
continue;
}
LLVOVolume* vobj = drawable->getVOVolume();
if (!vobj)
{
continue;
}
LLVolume* volume = vobj->getVolume();
S32 te = face->getTEOffset();
if (!volume || volume->getNumVolumeFaces() <= te || !volume->isMeshAssetLoaded())
{
continue;
}
LLUUID mesh_id = volume->getParams().getSculptID();
if (mesh_id.isNull())
{
continue;
}
const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, vobj);
if (!skin)
{
continue;
}
stop_glerror();
const LLVolumeFace& vol_face = volume->getVolumeFace(te);
updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face, vobj);
stop_glerror();
U32 data_mask = LLFace::getRiggedDataMask(type);
LLVertexBuffer* buff = face->getVertexBuffer();
if (buff)
{
if (sShaderLevel > 0)
{ //upload matrix palette to shader
LLMatrix4 mat[64];
for (U32 i = 0; i < skin->mJointNames.size(); ++i)
{
LLJoint* joint = avatar->getJoint(skin->mJointNames[i]);
if (joint)
{
mat[i] = skin->mInvBindMatrix[i];
mat[i] *= joint->getWorldMatrix();
}
}
stop_glerror();
LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette",
skin->mJointNames.size(),
FALSE,
(GLfloat*) mat[0].mMatrix);
stop_glerror();
}
else
{
data_mask &= ~LLVertexBuffer::MAP_WEIGHT4;
}
buff->setBuffer(data_mask);
U16 start = face->getGeomStart();
U16 end = start + face->getGeomCount()-1;
S32 offset = face->getIndicesStart();
U32 count = face->getIndicesCount();
if (glow)
{
glColor4f(0,0,0,face->getTextureEntry()->getGlow());
}
gGL.getTexUnit(sDiffuseChannel)->bind(face->getTexture());
if (normal_channel > -1)
{
//.........这里部分代码省略.........
示例4: stop_glerror
void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
{
if ((avatar->isSelf() && !gAgent.needsRenderAvatar()) || !gMeshRepo.meshRezEnabled())
{
return;
}
stop_glerror();
for (U32 i = 0; i < mRiggedFace[type].size(); ++i)
{
LLFace* face = mRiggedFace[type][i];
LLDrawable* drawable = face->getDrawable();
if (!drawable)
{
continue;
}
LLVOVolume* vobj = drawable->getVOVolume();
if (!vobj)
{
continue;
}
LLVolume* volume = vobj->getVolume();
S32 te = face->getTEOffset();
if (!volume || volume->getNumVolumeFaces() <= te || !volume->isMeshAssetLoaded())
{
continue;
}
LLUUID mesh_id = volume->getParams().getSculptID();
if (mesh_id.isNull())
{
continue;
}
const LLMeshSkinInfo* skin = gMeshRepo.getSkinInfo(mesh_id, vobj);
if (!skin)
{
continue;
}
//stop_glerror();
//const LLVolumeFace& vol_face = volume->getVolumeFace(te);
//updateRiggedFaceVertexBuffer(avatar, face, skin, volume, vol_face);
//stop_glerror();
U32 data_mask = LLFace::getRiggedDataMask(type);
LLVertexBuffer* buff = face->getVertexBuffer();
if (buff)
{
if (sShaderLevel > 0)
{ //upload matrix palette to shader
LLMatrix4 mat[JOINT_COUNT];
U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT);
for (U32 i = 0; i < count; ++i)
{
LLJoint* joint = avatar->getJoint(skin->mJointNames[i]);
if(!joint)
{
joint = avatar->getJoint("mRoot");
}
if (joint)
{
LLMatrix4a tmp;
tmp.loadu((F32*)skin->mInvBindMatrix[i].mMatrix);
tmp.setMul(joint->getWorldMatrix(),tmp);
mat[i] = LLMatrix4(tmp.getF32ptr());
}
}
stop_glerror();
F32 mp[JOINT_COUNT*12];
for (U32 i = 0; i < count; ++i)
{
F32* m = (F32*) mat[i].mMatrix;
U32 idx = i*12;
mp[idx+0] = m[0];
mp[idx+1] = m[1];
mp[idx+2] = m[2];
mp[idx+3] = m[12];
mp[idx+4] = m[4];
mp[idx+5] = m[5];
mp[idx+6] = m[6];
mp[idx+7] = m[13];
//.........这里部分代码省略.........
示例5: Setup
bool Setup()
{
axis = new Axis(Device);
accessSqlite();
//LLProfileParams profileParams = LLProfileParams(
// LL_PCODE_PROFILE_SQUARE, //Curve
// 0.f, //Begin
// 1.0f, //End
// 0.0f); //Hollow
//LLPathParams pathParams = LLPathParams(
// LL_PCODE_PATH_LINE, //curve
// 0.f, //begin
// 1.0f, //end
// 1.f, //scaleX
// 1.f, //scaleY
// 0.f, //shearX
// 0.f, //shearY
// 0.f, //twistEnd
// 0.f, //twistBegin
// 0.f, //radiusOffset
// 0.f, //taperX
// 0.f, //taperY
// 1.f, //revolutions
// 0.f); //skew
for(int i=0; i<profileParams.size(); i++)
{
LLVolumeParams volumeParams = LLVolumeParams(
profileParams[ i ],
pathParams[ i ],
0, //LLUUID
LL_SCULPT_TYPE_NONE);
LLVolume* volume = new LLVolume(
volumeParams,
4.f, //detail
false, //generate_single_face
FALSE); //is_unique
S32 numFaces = volume->getNumFaces();
for(S32 j=0; j<numFaces; j++)
{
LLVolumeFace volumeFace = volume->getVolumeFace(j);
obj.push_back( Object(Device, &volumeFace, positions[i], rotations[i], scales[i]));
}
}
//创建纹理
D3DXCreateTextureFromFile(
Device,
"testTex.jpg",
&Tex);
//HRESULT D3DXCreateFont(
// Device, //LPDIRECT3DDEVICE9 pDevice,
// 50, //INT Height,
// 20, //UINT Width,
// 500, //UINT Weight,
// 0, //UINT MipLevels,
// false, //BOOL Italic,
// DEFAULT_CHARSET, //DWORD CharSet,
// 0, //DWORD OutputPrecision,
// 0, //DWORD Quality,
// 0, //DWORD PitchAndFamily,
// "Arial", //LPCTSTR pFacename,
// &font //LPD3DXFONT * ppFont
//);
//RECT rect = {-1, 0, Width, Height};
/*
Set projection matrix
*/
D3DXMATRIX proj;
//正射投影
//D3DXMatrixOrthoLH(&proj,
// 5, //width of the view volume
// 5, //height of the view volume
// 1.0f, //z-near
// 1000.f); //z-far
//透视投影
D3DXMatrixPerspectiveFovLH(
&proj,
D3DX_PI * 0.25,
(float)Width/(float)Height,
1.0f,
1000.0f);
Device->SetTransform(D3DTS_PROJECTION, &proj);
return true;
}
示例6: getRect
void LLSceneView::draw()
{
S32 margin = 10;
S32 height = (S32) (gViewerWindow->getWindowRectScaled().getHeight()*0.75f);
S32 width = (S32) (gViewerWindow->getWindowRectScaled().getWidth() * 0.75f);
LLRect new_rect;
new_rect.setLeftTopAndSize(getRect().mLeft, getRect().mTop, width, height);
setRect(new_rect);
// Draw the window background
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gl_rect_2d(0, getRect().getHeight(), getRect().getWidth(), 0, LLColor4(0.f, 0.f, 0.f, 0.25f));
//aggregate some statistics
//object sizes
std::vector<F32> size[2];
//triangle counts
std::vector<S32> triangles[2];
std::vector<S32> visible_triangles[2];
S32 total_visible_triangles[] = {0, 0};
S32 total_triangles[] = {0, 0};
//streaming cost
std::vector<F32> streaming_cost[2];
F32 total_streaming[] = { 0.f, 0.f };
//physics cost
std::vector<F32> physics_cost[2];
F32 total_physics[] = { 0.f, 0.f };
U32 object_count = 0;
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
for (U32 i = 0; i < gObjectList.getNumObjects(); ++i)
{
LLViewerObject* object = gObjectList.getObject(i);
if (object &&
object->getVolume()&&
object->getRegion() == region)
{
U32 idx = object->isAttachment() ? 1 : 0;
LLVolume* volume = object->getVolume();
object_count++;
F32 radius = object->getScale().magVec();
size[idx].push_back(radius);
S32 visible = volume->getNumTriangles();
S32 high_triangles = object->getHighLODTriangleCount();
total_visible_triangles[idx] += visible;
total_triangles[idx] += high_triangles;
visible_triangles[idx].push_back(visible);
triangles[idx].push_back(high_triangles);
F32 streaming = object->getStreamingCost();
total_streaming[idx] += streaming;
streaming_cost[idx].push_back(streaming);
F32 physics = object->getPhysicsCost();
total_physics[idx] += physics;
physics_cost[idx].push_back(physics);
}
}
}
const char* category[] =
{
"Region",
"Attachment"
};
S32 graph_pos[4];
for (U32 i = 0; i < 4; ++i)
{
graph_pos[i] = new_rect.getHeight()/4*(i+1);
}
for (U32 idx = 0; idx < 2; idx++)
{
if (!size[idx].empty())
{ //display graph of object sizes
std::sort(size[idx].begin(), size[idx].end());
ll_remove_outliers(size[idx], 1.f);
LLRect size_rect;
if (idx == 0)
//.........这里部分代码省略.........
示例7: mt1
BOOL LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
const LLMatrix4& mat_vert_in, const LLMatrix3& mat_normal_in, BOOL global_volume)
{
LLMemType mt1(LLMemType::MTYPE_DRAWABLE);
//get bounding box
if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION
#if MESH_ENABLED
| LLDrawable::REBUILD_RIGGED
#endif //MESH_ENABLED
))
{
//VECTORIZE THIS
LLMatrix4a mat_vert;
mat_vert.loadu(mat_vert_in);
LLMatrix4a mat_normal;
mat_normal.loadu(mat_normal_in);
//if (mDrawablep->isState(LLDrawable::REBUILD_VOLUME))
//{ //vertex buffer no longer valid
// mVertexBuffer = NULL;
// mLastVertexBuffer = NULL;
//}
//VECTORIZE THIS
LLVector4a min,max;
if (f >= volume.getNumVolumeFaces())
{
llwarns << "Generating bounding box for invalid face index!" << llendl;
f = 0;
}
const LLVolumeFace &face = volume.getVolumeFace(f);
min = face.mExtents[0];
max = face.mExtents[1];
llassert(less_than_max_mag(min));
llassert(less_than_max_mag(max));
//min, max are in volume space, convert to drawable render space
LLVector4a center;
LLVector4a t;
t.setAdd(min, max);
t.mul(0.5f);
mat_vert.affineTransform(t, center);
LLVector4a size;
size.setSub(max, min);
size.mul(0.5f);
llassert(less_than_max_mag(min));
llassert(less_than_max_mag(max));
if (!global_volume)
{
//VECTORIZE THIS
LLVector4a scale;
scale.load3(mDrawablep->getVObj()->getScale().mV);
size.mul(scale);
}
mat_normal.mMatrix[0].normalize3fast();
mat_normal.mMatrix[1].normalize3fast();
mat_normal.mMatrix[2].normalize3fast();
LLVector4a v[4];
//get 4 corners of bounding box
mat_normal.rotate(size,v[0]);
//VECTORIZE THIS
LLVector4a scale;
scale.set(-1.f, -1.f, 1.f);
scale.mul(size);
mat_normal.rotate(scale, v[1]);
scale.set(1.f, -1.f, -1.f);
scale.mul(size);
mat_normal.rotate(scale, v[2]);
scale.set(-1.f, 1.f, -1.f);
scale.mul(size);
mat_normal.rotate(scale, v[3]);
LLVector4a& newMin = mExtents[0];
LLVector4a& newMax = mExtents[1];
newMin = newMax = center;
llassert(less_than_max_mag(center));
for (U32 i = 0; i < 4; i++)
{
LLVector4a delta;
delta.setAbs(v[i]);
LLVector4a min;
min.setSub(center, delta);
LLVector4a max;
//.........这里部分代码省略.........
示例8: llassert
BOOL LLFace::getGeometryVolume(const LLVolume& volume,
const S32 &f,
const LLMatrix4& mat_vert_in, const LLMatrix3& mat_norm_in,
const U16 &index_offset,
bool force_rebuild)
{
llassert(verify());
const LLVolumeFace &vf = volume.getVolumeFace(f);
S32 num_vertices = (S32)vf.mNumVertices;
S32 num_indices = (S32) vf.mNumIndices;
if (mVertexBuffer.notNull())
{
if (num_indices + (S32) mIndicesIndex > mVertexBuffer->getNumIndices())
{
llwarns << "Index buffer overflow!" << llendl;
llwarns << "Indices Count: " << mIndicesCount
<< " VF Num Indices: " << num_indices
<< " Indices Index: " << mIndicesIndex
<< " VB Num Indices: " << mVertexBuffer->getNumIndices() << llendl;
llwarns << "Last Indices Count: " << mLastIndicesCount
<< " Last Indices Index: " << mLastIndicesIndex
<< " Face Index: " << f
<< " Pool Type: " << mPoolType << llendl;
return FALSE;
}
if (num_vertices + mGeomIndex > mVertexBuffer->getNumVerts())
{
llwarns << "Vertex buffer overflow!" << llendl;
return FALSE;
}
}
LLStrider<LLVector3> vertices;
LLStrider<LLVector2> tex_coords;
LLStrider<LLVector2> tex_coords2;
LLStrider<LLVector3> normals;
LLStrider<LLColor4U> colors;
LLStrider<LLVector3> binormals;
LLStrider<U16> indicesp;
#if MESH_ENABLED
LLStrider<LLVector4> weights;
#endif //MESH_ENABLED
BOOL full_rebuild = force_rebuild || mDrawablep->isState(LLDrawable::REBUILD_VOLUME);
BOOL global_volume = mDrawablep->getVOVolume()->isVolumeGlobal();
LLVector3 scale;
if (global_volume)
{
scale.setVec(1,1,1);
}
else
{
scale = mVObjp->getScale();
}
bool rebuild_pos = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_POSITION);
bool rebuild_color = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_COLOR);
bool rebuild_tcoord = full_rebuild || mDrawablep->isState(LLDrawable::REBUILD_TCOORD);
bool rebuild_normal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_NORMAL);
bool rebuild_binormal = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_BINORMAL);
#if MESH_ENABLED
bool rebuild_weights = rebuild_pos && mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_WEIGHT4);
#endif //MESH_ENABLED
const LLTextureEntry *tep = mVObjp->getTE(f);
if (!tep) rebuild_color = FALSE; // can't get color when tep is NULL
U8 bump_code = tep ? tep->getBumpmap() : 0;
BOOL is_static = mDrawablep->isStatic();
BOOL is_global = is_static;
LLVector3 center_sum(0.f, 0.f, 0.f);
if (is_global)
{
setState(GLOBAL);
}
else
{
clearState(GLOBAL);
}
LLColor4U color = (tep ? LLColor4U(tep->getColor()) : LLColor4U::white);
if (rebuild_color) // FALSE if tep == NULL
{
if (tep)
{
GLfloat alpha[4] =
{
0.00f,
0.25f,
0.5f,
0.75f
};
//.........这里部分代码省略.........
示例9: setVisible
//.........这里部分代码省略.........
}
}
}
media_focused_panel->setVisible(mMediaFocus);
media_hover_panel->setVisible(!mMediaFocus);
if(media_plugin == NULL)
// Handle Scrolling
switch (mScrollState)
{
case SCROLL_UP:
media_plugin->scrollEvent(0, -1, MASK_NONE);
break;
case SCROLL_DOWN:
media_plugin->scrollEvent(0, 1, MASK_NONE);
break;
case SCROLL_LEFT:
mMediaImpl->handleKeyHere(KEY_LEFT, MASK_NONE);
break;
case SCROLL_RIGHT:
mMediaImpl->handleKeyHere(KEY_RIGHT, MASK_NONE);
break;
case SCROLL_NONE:
default:
break;
}
LLBBox screen_bbox;
setVisible(TRUE);
glh::matrix4f mat = glh_get_current_projection()*glh_get_current_modelview();
std::vector<LLVector3>::iterator vert_it;
std::vector<LLVector3>::iterator vert_end;
std::vector<LLVector3> vect_face;
LLVolume* volume = objectp->getVolume();
if (volume)
{
const LLVolumeFace& vf = volume->getVolumeFace(nodep->getLastSelectedTE());
const LLVector3* ext = vf.mExtents;
LLVector3 center = (ext[0]+ext[1])*0.5f;
LLVector3 size = (ext[1]-ext[0])*0.5f;
LLVector3 vert[] =
{
center + size.scaledVec(LLVector3(1,1,1)),
center + size.scaledVec(LLVector3(-1,1,1)),
center + size.scaledVec(LLVector3(1,-1,1)),
center + size.scaledVec(LLVector3(-1,-1,1)),
center + size.scaledVec(LLVector3(1,1,-1)),
center + size.scaledVec(LLVector3(-1,1,-1)),
center + size.scaledVec(LLVector3(1,-1,-1)),
center + size.scaledVec(LLVector3(-1,-1,-1)),
};
LLVOVolume* vo = (LLVOVolume*) objectp;
for (U32 i = 0; i < 8; i++)
{
vect_face.push_back(vo->volumePositionToAgent(vert[i]));
}
}
vert_it = vect_face.begin();
vert_end = vect_face.end();
LLVector3 min = LLVector3(1,1,1);