Merge branch 'master' into shader_pipeline
This commit is contained in:
commit
bd95db2031
@ -740,7 +740,7 @@ int main( int argc, char **argv )
|
|||||||
while(arguments.read("--addMissingColours") || arguments.read("--addMissingColors")) { addMissingColours = true; }
|
while(arguments.read("--addMissingColours") || arguments.read("--addMissingColors")) { addMissingColours = true; }
|
||||||
|
|
||||||
bool do_overallNormal = false;
|
bool do_overallNormal = false;
|
||||||
while(arguments.read("--overallNormal") || arguments.read("--overallNormal")) { do_overallNormal = true; }
|
while(arguments.read("--overallNormal")) { do_overallNormal = true; }
|
||||||
|
|
||||||
bool enableObjectCache = false;
|
bool enableObjectCache = false;
|
||||||
while(arguments.read("--enable-object-cache")) { enableObjectCache = true; }
|
while(arguments.read("--enable-object-cache")) { enableObjectCache = true; }
|
||||||
|
@ -570,16 +570,11 @@ void Geometry::setUseVertexBufferObjects(bool flag)
|
|||||||
DrawElementsList drawElementsList;
|
DrawElementsList drawElementsList;
|
||||||
getDrawElementsList(drawElementsList);
|
getDrawElementsList(drawElementsList);
|
||||||
|
|
||||||
typedef std::vector<osg::VertexBufferObject*> VertexBufferObjectList;
|
|
||||||
typedef std::vector<osg::ElementBufferObject*> ElementBufferObjectList;
|
|
||||||
|
|
||||||
/*if (_useVertexBufferObjects)*/
|
/*if (_useVertexBufferObjects)*/
|
||||||
{
|
{
|
||||||
if (!arrayList.empty())
|
if (!arrayList.empty())
|
||||||
{
|
{
|
||||||
|
|
||||||
VertexBufferObjectList vboList;
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::VertexBufferObject> vbo;
|
osg::ref_ptr<osg::VertexBufferObject> vbo;
|
||||||
|
|
||||||
ArrayList::iterator vitr;
|
ArrayList::iterator vitr;
|
||||||
@ -604,8 +599,6 @@ void Geometry::setUseVertexBufferObjects(bool flag)
|
|||||||
|
|
||||||
if (!drawElementsList.empty())
|
if (!drawElementsList.empty())
|
||||||
{
|
{
|
||||||
ElementBufferObjectList eboList;
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::ElementBufferObject> ebo;
|
osg::ref_ptr<osg::ElementBufferObject> ebo;
|
||||||
|
|
||||||
DrawElementsList::iterator deitr;
|
DrawElementsList::iterator deitr;
|
||||||
|
@ -1447,15 +1447,19 @@ namespace State_Utils
|
|||||||
if (str[pos]=='"' || str[pos]=='\'')
|
if (str[pos]=='"' || str[pos]=='\'')
|
||||||
{
|
{
|
||||||
std::string::size_type start_quote = pos;
|
std::string::size_type start_quote = pos;
|
||||||
++pos;
|
++pos; // skip over first quote
|
||||||
pos = str.find(str[start_quote], pos);
|
pos = str.find(str[start_quote], pos);
|
||||||
|
|
||||||
|
if (pos!=std::string::npos)
|
||||||
|
{
|
||||||
|
++pos; // skip over second quote
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string::size_type start_var = pos;
|
std::string::size_type start_var = pos;
|
||||||
++pos;
|
++pos;
|
||||||
pos = str.find_first_not_of("ABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_", pos);
|
pos = str.find_first_not_of("ABCDEFGHIJKLMNOPQRTSUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_", pos);
|
||||||
std::string var_str;
|
|
||||||
if (pos != std::string::npos)
|
if (pos != std::string::npos)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -39,17 +39,6 @@ int __gl_memInit( size_t /*maxFast*/ )
|
|||||||
{
|
{
|
||||||
#ifndef NO_MALLOPT
|
#ifndef NO_MALLOPT
|
||||||
/* mallopt( M_MXFAST, maxFast );*/
|
/* mallopt( M_MXFAST, maxFast );*/
|
||||||
#ifdef MEMORY_DEBUG
|
|
||||||
mallopt( M_DEBUG, 1 );
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MEMORY_DEBUG
|
|
||||||
void *__gl_memAlloc( size_t n )
|
|
||||||
{
|
|
||||||
return memset( malloc( n ), 0xa5, n );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
@ -41,14 +41,8 @@
|
|||||||
#define memFree free
|
#define memFree free
|
||||||
|
|
||||||
#define memInit __gl_memInit
|
#define memInit __gl_memInit
|
||||||
/*extern void __gl_memInit( size_t );*/
|
|
||||||
extern int __gl_memInit( size_t );
|
extern int __gl_memInit( size_t );
|
||||||
|
|
||||||
#ifndef MEMORY_DEBUG
|
|
||||||
#define memAlloc malloc
|
#define memAlloc malloc
|
||||||
#else
|
|
||||||
#define memAlloc __gl_memAlloc
|
|
||||||
extern void * __gl_memAlloc( size_t );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -409,7 +409,6 @@ struct ValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
|
|||||||
if (!visitor)
|
if (!visitor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::string font("fonts/arial.ttf");
|
|
||||||
float leftPos = 10.0f;
|
float leftPos = 10.0f;
|
||||||
float characterSize = 20.0f;
|
float characterSize = 20.0f;
|
||||||
|
|
||||||
@ -427,7 +426,7 @@ struct ValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<std::string>& channels = visitor->getChannels();
|
const std::vector<std::string>& channels = visitor->getChannels();
|
||||||
std::map<std::string,int> size;
|
// std::map<std::string,int> size;
|
||||||
for (int i = 0; i < (int)channels.size(); i++) {
|
for (int i = 0; i < (int)channels.size(); i++) {
|
||||||
std::string name = channels[i];
|
std::string name = channels[i];
|
||||||
if (_actions.find(name) == _actions.end()) {
|
if (_actions.find(name) == _actions.end()) {
|
||||||
@ -440,14 +439,14 @@ struct ValueTextDrawCallback : public virtual osg::Drawable::DrawCallback
|
|||||||
//_actions[name].touch();
|
//_actions[name].touch();
|
||||||
}
|
}
|
||||||
_actions[name]._group->setNodeMask(~osg::Node::NodeMask(0x0));
|
_actions[name]._group->setNodeMask(~osg::Node::NodeMask(0x0));
|
||||||
size[name] = 0;
|
//size[name] = 0;
|
||||||
pos.y() -= characterSize + graphSpacing;
|
pos.y() -= characterSize + graphSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos.y() -= backgroundMargin;
|
pos.y() -= backgroundMargin;
|
||||||
osg::Vec3Array* array = static_cast<osg::Vec3Array*>(_background->getVertexArray());
|
osg::Vec3Array* array = static_cast<osg::Vec3Array*>(_background->getVertexArray());
|
||||||
float y = (*array)[0][1];
|
// float y = (*array)[0][1];
|
||||||
y = y - (pos.y() + backgroundMargin); //(2 * backgroundMargin + (size.size() * (characterSize + graphSpacing)));
|
// y = y - (pos.y() + backgroundMargin); //(2 * backgroundMargin + (size.size() * (characterSize + graphSpacing)));
|
||||||
(*array)[1][1] = pos.y();
|
(*array)[1][1] = pos.y();
|
||||||
(*array)[2][1] = pos.y();
|
(*array)[2][1] = pos.y();
|
||||||
array->dirty();
|
array->dirty();
|
||||||
|
@ -77,10 +77,6 @@ void StatsActionVisitor::apply(ActionStripAnimation& action)
|
|||||||
if (isActive(action))
|
if (isActive(action))
|
||||||
{
|
{
|
||||||
_channels.push_back(action.getName());
|
_channels.push_back(action.getName());
|
||||||
double value;
|
|
||||||
std::string name = action.getName();
|
|
||||||
if (_stats->getAttribute(_frame, name, value))
|
|
||||||
name += "+";
|
|
||||||
_stats->setAttribute(_frame, action.getName(), action.getAnimation()->getAnimation()->getWeight());
|
_stats->setAttribute(_frame, action.getName(), action.getAnimation()->getAnimation()->getWeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,12 @@ osg::ref_ptr<osg::Image> InputStream::readImage(bool readFromExternal)
|
|||||||
char* data = new char[size];
|
char* data = new char[size];
|
||||||
if ( !data )
|
if ( !data )
|
||||||
throwException( "InputStream::readImage() Out of memory." );
|
throwException( "InputStream::readImage() Out of memory." );
|
||||||
if ( getException() ) return NULL;
|
|
||||||
|
if ( getException() )
|
||||||
|
{
|
||||||
|
delete [] data;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
readCharArray( data, size );
|
readCharArray( data, size );
|
||||||
image = new osg::Image;
|
image = new osg::Image;
|
||||||
|
@ -860,7 +860,6 @@ void OutputStream::writeSchema( std::ostream& fout )
|
|||||||
ObjectWrapper::TypeList types;
|
ObjectWrapper::TypeList types;
|
||||||
wrapper->writeSchema( properties, types );
|
wrapper->writeSchema( properties, types );
|
||||||
|
|
||||||
std::string propertiesString;
|
|
||||||
unsigned int size = osg::minimum( properties.size(), types.size() );
|
unsigned int size = osg::minimum( properties.size(), types.size() );
|
||||||
for ( unsigned int i=0; i<size; ++i )
|
for ( unsigned int i=0; i<size; ++i )
|
||||||
{
|
{
|
||||||
|
@ -536,11 +536,6 @@ void UFOManipulator::_adjustPosition()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Forward line segment at 3 times our intersect distance
|
// Forward line segment at 3 times our intersect distance
|
||||||
|
|
||||||
|
|
||||||
typedef std::vector<osg::Vec3d> Intersections;
|
|
||||||
Intersections intersections;
|
|
||||||
|
|
||||||
// Check intersects infront.
|
// Check intersects infront.
|
||||||
osg::Vec3d ip;
|
osg::Vec3d ip;
|
||||||
if (intersect(_position,
|
if (intersect(_position,
|
||||||
|
@ -36,8 +36,6 @@ Q3BSPReader::Q3BSPReader()
|
|||||||
bool Q3BSPReader::readFile(const std::string& file,
|
bool Q3BSPReader::readFile(const std::string& file,
|
||||||
const osgDB::ReaderWriter::Options* options)
|
const osgDB::ReaderWriter::Options* options)
|
||||||
{
|
{
|
||||||
std::string ext = osgDB::getLowerCaseFileExtension(file);
|
|
||||||
|
|
||||||
Q3BSPLoad load_data;
|
Q3BSPLoad load_data;
|
||||||
load_data.Load(file,8);
|
load_data.Load(file,8);
|
||||||
|
|
||||||
@ -513,7 +511,7 @@ bool Q3BSPReader::loadLightMaps(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// A continuación, añado el blanco
|
// A continuacin, aado el blanco
|
||||||
osg::Image* image=new osg::Image;
|
osg::Image* image=new osg::Image;
|
||||||
unsigned char *data=new unsigned char[3];
|
unsigned char *data=new unsigned char[3];
|
||||||
for(int whiteidx=0;whiteidx<3;whiteidx++)
|
for(int whiteidx=0;whiteidx<3;whiteidx++)
|
||||||
|
@ -653,8 +653,6 @@ ref_ptr<StateSet> VBSPReader::readMaterialFile(std::string materialName)
|
|||||||
bool found = false;
|
bool found = false;
|
||||||
ref_ptr<StateSet> stateSet;
|
ref_ptr<StateSet> stateSet;
|
||||||
std::string shaderName;
|
std::string shaderName;
|
||||||
std::string texName;
|
|
||||||
std::string tex2Name;
|
|
||||||
ref_ptr<Texture> texture;
|
ref_ptr<Texture> texture;
|
||||||
ref_ptr<Texture> texture2;
|
ref_ptr<Texture> texture2;
|
||||||
ref_ptr<TexEnvCombine> combiner0;
|
ref_ptr<TexEnvCombine> combiner0;
|
||||||
@ -992,7 +990,6 @@ void VBSPReader::createScene()
|
|||||||
Quat yaw, pitch, roll;
|
Quat yaw, pitch, roll;
|
||||||
ref_ptr<MatrixTransform> propXform;
|
ref_ptr<MatrixTransform> propXform;
|
||||||
std::string propModel;
|
std::string propModel;
|
||||||
std::string propFile;
|
|
||||||
ref_ptr<Node> propNode;
|
ref_ptr<Node> propNode;
|
||||||
|
|
||||||
// Load the materials and create a StateSet for each one
|
// Load the materials and create a StateSet for each one
|
||||||
|
@ -589,8 +589,6 @@ bool daeReader::processColorOrTextureType(const osg::StateSet* ss,
|
|||||||
}
|
}
|
||||||
bool retVal = false;
|
bool retVal = false;
|
||||||
|
|
||||||
std::string texCoordSet;
|
|
||||||
|
|
||||||
//osg::StateAttribute *sa = NULL;
|
//osg::StateAttribute *sa = NULL;
|
||||||
//TODO: Make all channels process <param ref=""> type of value
|
//TODO: Make all channels process <param ref=""> type of value
|
||||||
if (channel == osg::Material::EMISSION )
|
if (channel == osg::Material::EMISSION )
|
||||||
|
@ -361,7 +361,7 @@ osg::Node* daeReader::processLight( domLight *dlight )
|
|||||||
lightmodel->setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
|
lightmodel->setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
|
||||||
_rootStateSet->setAttributeAndModes(lightmodel, osg::StateAttribute::ON);
|
_rootStateSet->setAttributeAndModes(lightmodel, osg::StateAttribute::ON);
|
||||||
|
|
||||||
osg::LightSource* lightsource = new osg::LightSource();
|
osg::ref_ptr<osg::LightSource> lightsource = new osg::LightSource();
|
||||||
lightsource->setLight(light);
|
lightsource->setLight(light);
|
||||||
std::string name = dlight->getId() ? dlight->getId() : "";
|
std::string name = dlight->getId() ? dlight->getId() : "";
|
||||||
if (dlight->getName())
|
if (dlight->getName())
|
||||||
@ -520,7 +520,7 @@ osg::Node* daeReader::processLight( domLight *dlight )
|
|||||||
light->setDirection(osg::Vec3(0, 0, -1));
|
light->setDirection(osg::Vec3(0, 0, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return lightsource;
|
return lightsource.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
// <camera>
|
// <camera>
|
||||||
|
@ -689,7 +689,7 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
OSG_DEBUG << "ReaderWriterJPEG::write_JPEG_file - Error pixel format non supported" << std::endl;
|
OSG_DEBUG << "ReaderWriterJPEG::write_JPEG_file - Error pixel format non supported" << std::endl;
|
||||||
return WriteResult::ERROR_IN_WRITING_FILE; break;
|
return WriteResult::ERROR_IN_WRITING_FILE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,6 @@ bool Model::readMTL(std::istream& fin)
|
|||||||
bool usingDissolve = false;
|
bool usingDissolve = false;
|
||||||
|
|
||||||
Material* material = 0;// &(materialMap[""]);
|
Material* material = 0;// &(materialMap[""]);
|
||||||
std::string filename;
|
|
||||||
|
|
||||||
while (fin)
|
while (fin)
|
||||||
{
|
{
|
||||||
|
@ -262,8 +262,6 @@ public:
|
|||||||
|
|
||||||
osg::Geometry* multiPointToDrawable(OGRMultiPoint* mpoint) const
|
osg::Geometry* multiPointToDrawable(OGRMultiPoint* mpoint) const
|
||||||
{
|
{
|
||||||
osg::Geometry* geom = new osg::Geometry;
|
|
||||||
|
|
||||||
osg::Geometry* pointGeom = new osg::Geometry();
|
osg::Geometry* pointGeom = new osg::Geometry();
|
||||||
osg::Vec3Array* vertices = new osg::Vec3Array();
|
osg::Vec3Array* vertices = new osg::Vec3Array();
|
||||||
|
|
||||||
@ -286,7 +284,7 @@ public:
|
|||||||
|
|
||||||
if (pointGeom->getVertexArray())
|
if (pointGeom->getVertexArray())
|
||||||
{
|
{
|
||||||
OSG_INFO << "osgOgrFeature::multiPointToDrawable " << geom->getVertexArray()->getNumElements() << " vertexes"<< std::endl;
|
OSG_INFO << "osgOgrFeature::multiPointToDrawable " << pointGeom->getVertexArray()->getNumElements() << " vertexes"<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pointGeom;
|
return pointGeom;
|
||||||
|
@ -405,6 +405,7 @@ int *numComponents_ret)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tgaerror = ERR_UNSUPPORTED;
|
tgaerror = ERR_UNSUPPORTED;
|
||||||
|
delete [] formattedMap;
|
||||||
return NULL; /* unreachable code - (depth < 1 || depth > 4) rejected by "check for reasonable values in case this is not a tga file" near the start of this function*/
|
return NULL; /* unreachable code - (depth < 1 || depth > 4) rejected by "check for reasonable values in case this is not a tga file" near the start of this function*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,8 +416,7 @@ int *numComponents_ret)
|
|||||||
dest += lineoffset;
|
dest += lineoffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formattedMap)
|
delete [] formattedMap;
|
||||||
delete[] formattedMap;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: /* RGB, uncompressed */
|
case 2: /* RGB, uncompressed */
|
||||||
|
@ -1183,21 +1183,21 @@ void SharedArrayOptimizer::findDuplicatedUVs(const osg::Geometry& geometry)
|
|||||||
{
|
{
|
||||||
_deduplicateUvs.clear();
|
_deduplicateUvs.clear();
|
||||||
|
|
||||||
// look for all channels that are shared only *within* the geometry
|
// look for all arrays that are shared only *within* the geometry
|
||||||
std::map<const osg::Array*, unsigned int> arrayPointerCounter;
|
std::map<const osg::Array*, unsigned int> arrayPointerCounter;
|
||||||
|
|
||||||
for(unsigned int id = 0 ; id < geometry.getNumTexCoordArrays() ; ++ id)
|
for(unsigned int id = 0 ; id < geometry.getNumTexCoordArrays() ; ++ id)
|
||||||
{
|
{
|
||||||
const osg::Array* channel = geometry.getTexCoordArray(id);
|
const osg::Array* array = geometry.getTexCoordArray(id);
|
||||||
if(channel && channel->getNumElements())
|
if(array && array->getNumElements())
|
||||||
{
|
{
|
||||||
if(arrayPointerCounter.find(channel) == arrayPointerCounter.end())
|
if(arrayPointerCounter.find(array) == arrayPointerCounter.end())
|
||||||
{
|
{
|
||||||
arrayPointerCounter[channel] = 1;
|
arrayPointerCounter[array] = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
arrayPointerCounter[channel] += 1;
|
arrayPointerCounter[array] += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1206,14 +1206,14 @@ void SharedArrayOptimizer::findDuplicatedUVs(const osg::Geometry& geometry)
|
|||||||
|
|
||||||
for(unsigned int id = 0 ; id != geometry.getNumTexCoordArrays() ; ++ id)
|
for(unsigned int id = 0 ; id != geometry.getNumTexCoordArrays() ; ++ id)
|
||||||
{
|
{
|
||||||
const osg::Array* channel = geometry.getTexCoordArray(id);
|
const osg::Array* array = geometry.getTexCoordArray(id);
|
||||||
// test if array is shared outside the geometry
|
// test if array is shared inside the geometry
|
||||||
if(channel && static_cast<unsigned int>(channel->referenceCount()) == arrayPointerCounter[channel])
|
if(array && arrayPointerCounter[array] > 1)
|
||||||
{
|
{
|
||||||
std::map<const osg::Array*, unsigned int>::const_iterator reference = references.find(channel);
|
std::map<const osg::Array*, unsigned int>::const_iterator reference = references.find(array);
|
||||||
if(reference == references.end())
|
if(reference == references.end())
|
||||||
{
|
{
|
||||||
references[channel] = id;
|
references[array] = id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -20,9 +20,8 @@ osg::PrimitiveSet * drawElementsTemplate(GLenum mode,GLsizei count, const typena
|
|||||||
{
|
{
|
||||||
if (indices==0 || count==0) return NULL;
|
if (indices==0 || count==0) return NULL;
|
||||||
|
|
||||||
Type * dePtr = new Type(mode);
|
Type * primitives = new Type(mode);
|
||||||
Type & de = *dePtr;
|
primitives->reserve(count);
|
||||||
de.reserve(count);
|
|
||||||
|
|
||||||
typedef const typename Type::value_type* IndexPointer;
|
typedef const typename Type::value_type* IndexPointer;
|
||||||
|
|
||||||
@ -34,9 +33,9 @@ osg::PrimitiveSet * drawElementsTemplate(GLenum mode,GLsizei count, const typena
|
|||||||
|
|
||||||
for (IndexPointer iptr=indices; iptr<ilast; iptr+=3)
|
for (IndexPointer iptr=indices; iptr<ilast; iptr+=3)
|
||||||
{
|
{
|
||||||
de.push_back(*(iptr));
|
primitives->push_back(*(iptr));
|
||||||
de.push_back(*(iptr+2));
|
primitives->push_back(*(iptr+2));
|
||||||
de.push_back(*(iptr+1));
|
primitives->push_back(*(iptr+1));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -46,10 +45,10 @@ osg::PrimitiveSet * drawElementsTemplate(GLenum mode,GLsizei count, const typena
|
|||||||
IndexPointer ilast = &indices[count - 3];
|
IndexPointer ilast = &indices[count - 3];
|
||||||
for (IndexPointer iptr = indices; iptr<ilast; iptr+=4)
|
for (IndexPointer iptr = indices; iptr<ilast; iptr+=4)
|
||||||
{
|
{
|
||||||
de.push_back(*(iptr));
|
primitives->push_back(*(iptr));
|
||||||
de.push_back(*(iptr+3));
|
primitives->push_back(*(iptr+3));
|
||||||
de.push_back(*(iptr+2));
|
primitives->push_back(*(iptr+2));
|
||||||
de.push_back(*(iptr+1));
|
primitives->push_back(*(iptr+1));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -59,19 +58,19 @@ osg::PrimitiveSet * drawElementsTemplate(GLenum mode,GLsizei count, const typena
|
|||||||
IndexPointer ilast = &indices[count];
|
IndexPointer ilast = &indices[count];
|
||||||
for (IndexPointer iptr = indices; iptr<ilast; iptr+=2)
|
for (IndexPointer iptr = indices; iptr<ilast; iptr+=2)
|
||||||
{
|
{
|
||||||
de.push_back(*(iptr+1));
|
primitives->push_back(*(iptr+1));
|
||||||
de.push_back(*(iptr));
|
primitives->push_back(*(iptr));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (GL_TRIANGLE_FAN):
|
case (GL_TRIANGLE_FAN):
|
||||||
{
|
{
|
||||||
de.push_back(*indices);
|
primitives->push_back(*indices);
|
||||||
|
|
||||||
IndexPointer iptr = indices + 1;
|
IndexPointer iptr = indices + 1;
|
||||||
IndexPointer ilast = &indices[count];
|
IndexPointer ilast = &indices[count];
|
||||||
de.resize(count);
|
primitives->resize(count);
|
||||||
std::reverse_copy(iptr, ilast, de.begin() + 1);
|
std::reverse_copy(iptr, ilast, primitives->begin() + 1);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -83,8 +82,8 @@ osg::PrimitiveSet * drawElementsTemplate(GLenum mode,GLsizei count, const typena
|
|||||||
{
|
{
|
||||||
IndexPointer iptr = indices;
|
IndexPointer iptr = indices;
|
||||||
IndexPointer ilast = &indices[count];
|
IndexPointer ilast = &indices[count];
|
||||||
de.resize(count);
|
primitives->resize(count);
|
||||||
std::reverse_copy(iptr, ilast, de.begin());
|
std::reverse_copy(iptr, ilast, primitives->begin());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -92,7 +91,7 @@ osg::PrimitiveSet * drawElementsTemplate(GLenum mode,GLsizei count, const typena
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &de;
|
return primitives;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace osgUtil {
|
namespace osgUtil {
|
||||||
@ -101,9 +100,8 @@ void ReversePrimitiveFunctor::drawArrays(GLenum mode, GLint first, GLsizei count
|
|||||||
{
|
{
|
||||||
if (count==0) return ;
|
if (count==0) return ;
|
||||||
|
|
||||||
osg::DrawElementsUInt * dePtr = new osg::DrawElementsUInt(mode);
|
osg::DrawElementsUInt * primitives = new osg::DrawElementsUInt(mode);
|
||||||
osg::DrawElementsUInt & de = *dePtr;
|
primitives->reserve(count);
|
||||||
de.reserve(count);
|
|
||||||
|
|
||||||
GLint end = first + count;
|
GLint end = first + count;
|
||||||
|
|
||||||
@ -113,9 +111,9 @@ void ReversePrimitiveFunctor::drawArrays(GLenum mode, GLint first, GLsizei count
|
|||||||
{
|
{
|
||||||
for (GLint i=first; i<end; i+=3)
|
for (GLint i=first; i<end; i+=3)
|
||||||
{
|
{
|
||||||
de.push_back(i);
|
primitives->push_back(i);
|
||||||
de.push_back(i+2);
|
primitives->push_back(i+2);
|
||||||
de.push_back(i+1);
|
primitives->push_back(i+1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -123,10 +121,10 @@ void ReversePrimitiveFunctor::drawArrays(GLenum mode, GLint first, GLsizei count
|
|||||||
{
|
{
|
||||||
for (GLint i=first; i<end; i+=4)
|
for (GLint i=first; i<end; i+=4)
|
||||||
{
|
{
|
||||||
de.push_back(i);
|
primitives->push_back(i);
|
||||||
de.push_back(i+3);
|
primitives->push_back(i+3);
|
||||||
de.push_back(i+2);
|
primitives->push_back(i+2);
|
||||||
de.push_back(i+1);
|
primitives->push_back(i+1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -135,17 +133,17 @@ void ReversePrimitiveFunctor::drawArrays(GLenum mode, GLint first, GLsizei count
|
|||||||
{
|
{
|
||||||
for (GLint i=first; i<end; i+=2)
|
for (GLint i=first; i<end; i+=2)
|
||||||
{
|
{
|
||||||
de.push_back(i+1);
|
primitives->push_back(i+1);
|
||||||
de.push_back(i);
|
primitives->push_back(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (GL_TRIANGLE_FAN):
|
case (GL_TRIANGLE_FAN):
|
||||||
{
|
{
|
||||||
de.push_back(first);
|
primitives->push_back(first);
|
||||||
|
|
||||||
for (GLint i=end-1; i>first; i--)
|
for (GLint i=end-1; i>first; i--)
|
||||||
de.push_back(i);
|
primitives->push_back(i);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -156,7 +154,7 @@ void ReversePrimitiveFunctor::drawArrays(GLenum mode, GLint first, GLsizei count
|
|||||||
case (GL_LINE_LOOP):
|
case (GL_LINE_LOOP):
|
||||||
{
|
{
|
||||||
for (GLint i=end-1; i>=first; i--)
|
for (GLint i=end-1; i>=first; i--)
|
||||||
de.push_back(i);
|
primitives->push_back(i);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -164,7 +162,7 @@ void ReversePrimitiveFunctor::drawArrays(GLenum mode, GLint first, GLsizei count
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_reversedPrimitiveSet = &de;
|
_reversedPrimitiveSet = primitives;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReversePrimitiveFunctor::drawElements(GLenum mode,GLsizei count,const GLubyte* indices)
|
void ReversePrimitiveFunctor::drawElements(GLenum mode,GLsizei count,const GLubyte* indices)
|
||||||
|
@ -743,7 +743,7 @@ void SceneView::cull()
|
|||||||
_cullVisitorRight->setClampProjectionMatrixCallback(_cullVisitor->getClampProjectionMatrixCallback());
|
_cullVisitorRight->setClampProjectionMatrixCallback(_cullVisitor->getClampProjectionMatrixCallback());
|
||||||
_cullVisitorRight->setTraversalMask(_cullMaskRight);
|
_cullVisitorRight->setTraversalMask(_cullMaskRight);
|
||||||
computeRightEyeViewport(getViewport());
|
computeRightEyeViewport(getViewport());
|
||||||
computeNearFar = cullStage(computeRightEyeProjection(getProjectionMatrix()),computeRightEyeView(getViewMatrix()),_cullVisitorRight.get(),_stateGraphRight.get(),_renderStageRight.get(),_viewportRight.get());
|
computeNearFar = cullStage(computeRightEyeProjection(getProjectionMatrix()),computeRightEyeView(getViewMatrix()),_cullVisitorRight.get(),_stateGraphRight.get(),_renderStageRight.get(),_viewportRight.get()) | computeNearFar;
|
||||||
|
|
||||||
if (computeNearFar)
|
if (computeNearFar)
|
||||||
{
|
{
|
||||||
|
@ -267,7 +267,6 @@ public:
|
|||||||
typedef std::vector< osg::ref_ptr<Point> > PointList;
|
typedef std::vector< osg::ref_ptr<Point> > PointList;
|
||||||
typedef std::list< osg::ref_ptr<Triangle> > TriangleList;
|
typedef std::list< osg::ref_ptr<Triangle> > TriangleList;
|
||||||
typedef std::set< osg::ref_ptr<Triangle> > TriangleSet;
|
typedef std::set< osg::ref_ptr<Triangle> > TriangleSet;
|
||||||
typedef std::map< osg::ref_ptr<Triangle>, unsigned int, dereference_less > TriangleMap;
|
|
||||||
|
|
||||||
struct Point : public osg::Referenced
|
struct Point : public osg::Referenced
|
||||||
{
|
{
|
||||||
@ -813,7 +812,6 @@ public:
|
|||||||
osg::ref_ptr<Point> edge_p1 = edge->_p1;
|
osg::ref_ptr<Point> edge_p1 = edge->_p1;
|
||||||
osg::ref_ptr<Point> edge_p2 = edge->_p2;
|
osg::ref_ptr<Point> edge_p2 = edge->_p2;
|
||||||
|
|
||||||
TriangleMap triangleMap;
|
|
||||||
TriangleList triangles_p1;
|
TriangleList triangles_p1;
|
||||||
TriangleList triangles_p2;
|
TriangleList triangles_p2;
|
||||||
LocalEdgeList oldEdges;
|
LocalEdgeList oldEdges;
|
||||||
|
@ -607,7 +607,7 @@ void TriStripVisitor::mergeTriangleStrips(osg::Geometry::PrimitiveSetList& primi
|
|||||||
osg::PrimitiveSet* ps = primitives[i].get();
|
osg::PrimitiveSet* ps = primitives[i].get();
|
||||||
// remove null primitive sets and all primitives that have been merged
|
// remove null primitive sets and all primitives that have been merged
|
||||||
// (i.e. all TRIANGLE_STRIP DrawElements)
|
// (i.e. all TRIANGLE_STRIP DrawElements)
|
||||||
if (!ps || (ps && ps->getMode() == osg::PrimitiveSet::TRIANGLE_STRIP))
|
if (ps && ps->getMode() == osg::PrimitiveSet::TRIANGLE_STRIP)
|
||||||
{
|
{
|
||||||
primitives.erase(primitives.begin() + i);
|
primitives.erase(primitives.begin() + i);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user