Minor renderer updates.

This commit is contained in:
Shyotl
2011-09-23 00:55:24 -05:00
parent c621cb7719
commit 7f934f34f1
5 changed files with 67 additions and 7 deletions

View File

@@ -1929,10 +1929,66 @@ bool LLModel::loadModel(std::istream& is)
} }
void LLModel::matchMaterialOrder(LLModel* ref) bool LLModel::isMaterialListSubset( LLModel* ref )
{ {
llassert(ref->mMaterialList.size() == mMaterialList.size()); S32 refCnt = ref->mMaterialList.size();
S32 modelCnt = mMaterialList.size();
for (S32 src = 0; src < modelCnt; ++src)
{
bool foundRef = false;
for (S32 dst = 0; dst < refCnt; ++dst)
{
//llinfos<<mMaterialList[src]<<" "<<ref->mMaterialList[dst]<<llendl;
foundRef = mMaterialList[src] == ref->mMaterialList[dst];
if ( foundRef )
{
break;
}
}
if (!foundRef)
{
return false;
}
}
return true;
}
bool LLModel::needToAddFaces( LLModel* ref, int& refFaceCnt, int& modelFaceCnt )
{
bool changed = false;
if ( refFaceCnt< modelFaceCnt )
{
refFaceCnt += modelFaceCnt - refFaceCnt;
changed = true;
}
else
if ( modelFaceCnt < refFaceCnt )
{
modelFaceCnt += refFaceCnt - modelFaceCnt;
changed = true;
}
return changed;
}
bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCnt )
{
//Is this a subset?
//LODs cannot currently add new materials, e.g.
//1. ref = a,b,c lod1 = d,e => This is not permitted
//2. ref = a,b,c lod1 = c => This would be permitted
bool isASubset = isMaterialListSubset( ref );
if ( !isASubset )
{
llinfos<<"Material of model is not a subset of reference."<<llendl;
return false;
}
std::map<std::string, U32> index_map; std::map<std::string, U32> index_map;
//build a map of material slot names to face indexes //build a map of material slot names to face indexes
@@ -1978,6 +2034,7 @@ void LLModel::matchMaterialOrder(LLModel* ref)
//override material list with reference model ordering //override material list with reference model ordering
mMaterialList = ref->mMaterialList; mMaterialList = ref->mMaterialList;
return true;
} }

View File

@@ -180,8 +180,10 @@ public:
//reorder face list based on mMaterialList in this and reference so //reorder face list based on mMaterialList in this and reference so
//order matches that of reference (material ordering touchup) //order matches that of reference (material ordering touchup)
void matchMaterialOrder(LLModel* reference); bool matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCnt );
bool isMaterialListSubset( LLModel* ref );
bool needToAddFaces( LLModel* ref, int& refFaceCnt, int& modelFaceCnt );
std::vector<std::string> mMaterialList; std::vector<std::string> mMaterialList;
//data used for skin weights //data used for skin weights

View File

@@ -1410,7 +1410,7 @@ void LLImageGL::deleteDeadTextures()
{ {
LLTexUnit* tex_unit = gGL.getTexUnit(i); LLTexUnit* tex_unit = gGL.getTexUnit(i);
if (tex_unit->getCurrTexture() == tex) if (tex_unit && tex_unit->getCurrTexture() == tex)
{ {
tex_unit->unbind(tex_unit->getCurrType()); tex_unit->unbind(tex_unit->getCurrType());
stop_glerror(); stop_glerror();

View File

@@ -2842,7 +2842,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e
bool special_cursor = specialHoverCursor(); bool special_cursor = specialHoverCursor();
for (S32 i = start_face; i < end_face; ++i) for (S32 i = start_face; i < end_face; ++i)
{ {
if (!special_cursor && !pick_transparent && getTE(i)->getColor().mV[3] == 0.f) if (!special_cursor && !pick_transparent && getTE(i) && getTE(i)->getColor().mV[3] == 0.f)
{ //don't attempt to pick completely transparent faces unless { //don't attempt to pick completely transparent faces unless
//pick_transparent is true //pick_transparent is true
continue; continue;

View File

@@ -3878,6 +3878,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
occlude = FALSE; occlude = FALSE;
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixd(gGLModelView);
LLGLSLShader::bindNoShader();
doOcclusion(camera); doOcclusion(camera);
gGLLastMatrix = NULL; gGLLastMatrix = NULL;
glLoadMatrixd(gGLModelView); glLoadMatrixd(gGLModelView);
@@ -9410,7 +9411,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
{ //create alpha mask based on depth buffer (grey out if muted) { //create alpha mask based on depth buffer (grey out if muted)
if (LLPipeline::sRenderDeferred) if (LLPipeline::sRenderDeferred)
{ {
GLuint buff = GL_COLOR_ATTACHMENT0_EXT; GLuint buff = GL_COLOR_ATTACHMENT0;
glDrawBuffersARB(1, &buff); glDrawBuffersARB(1, &buff);
} }