Merge branch 'master' into text_improvements
This commit is contained in:
@@ -49,23 +49,34 @@ public:
|
||||
{
|
||||
if (ea.getKey() == osgGA::GUIEventAdapter::KEY_Up)
|
||||
{
|
||||
m_Text3D->setCharacterSize(m_Text3D->getCharacterHeight() + 0.1); // failed
|
||||
OSG_NOTICE<<"m_Text3D->getCharacterHeight()="<<m_Text3D->getCharacterHeight()<<std::endl;
|
||||
m_Text3D->setCharacterSize(m_Text3D->getCharacterHeight() + 0.1);
|
||||
OSG_NOTICE<<"m_Text3D->getCharacterHeight() = " << m_Text3D->getCharacterHeight() << std::endl;
|
||||
}
|
||||
else if (ea.getKey() == osgGA::GUIEventAdapter::KEY_Down)
|
||||
{
|
||||
m_Text3D->setCharacterDepth(m_Text3D->getCharacterDepth() + 0.1); // ok
|
||||
OSG_NOTICE<<"m_Text3D->getCharacterDepth()="<<m_Text3D->getCharacterDepth()<<std::endl;
|
||||
m_Text3D->setCharacterDepth(m_Text3D->getCharacterDepth() + 0.1);
|
||||
OSG_NOTICE<<"m_Text3D->getCharacterDepth() = " << m_Text3D->getCharacterDepth() << std::endl;
|
||||
}
|
||||
else if (ea.getKey() == osgGA::GUIEventAdapter::KEY_Left)
|
||||
{
|
||||
m_Text3D->setText("setText\nworks!", osgText::String::ENCODING_UTF8); // ok
|
||||
OSG_NOTICE<<"m_Text3D->getText()="<<m_Text3D->getText().size()<<std::endl;
|
||||
static int counter = 1;
|
||||
if (counter%3 == 0)
|
||||
m_Text3D->setText("Press arrow keys.", osgText::String::ENCODING_UTF8);
|
||||
else if (counter%3 == 1)
|
||||
m_Text3D->setText("setText\nworks!", osgText::String::ENCODING_UTF8);
|
||||
else if (counter%3 == 2)
|
||||
m_Text3D->setText("setText really works?", osgText::String::ENCODING_UTF8);
|
||||
else if (counter%3 == 3)
|
||||
m_Text3D->setText("setText works, really!", osgText::String::ENCODING_UTF8);
|
||||
|
||||
++counter;
|
||||
|
||||
OSG_NOTICE<<"m_Text3D->getText().size() = " << m_Text3D->getText().size() << std::endl;
|
||||
}
|
||||
else if (ea.getKey() == osgGA::GUIEventAdapter::KEY_Right)
|
||||
{
|
||||
m_Text3D->setLineSpacing(m_Text3D->getLineSpacing() + 0.1);
|
||||
OSG_NOTICE<<"m_Text3D->getLineSpacing()="<<m_Text3D->getLineSpacing()<<std::endl;
|
||||
OSG_NOTICE<<"m_Text3D->getLineSpacing() = " << m_Text3D->getLineSpacing() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +101,7 @@ int main(int argc, char** argv)
|
||||
if (!font) return 1;
|
||||
OSG_NOTICE<<"Read font "<<fontFile<<" font="<<font.get()<<std::endl;
|
||||
|
||||
std::string word("This is a new test.");
|
||||
std::string word("Press arrow keys.");
|
||||
while (arguments.read("-w",word)) {}
|
||||
|
||||
osg::ref_ptr<osgText::Style> style = new osgText::Style;
|
||||
@@ -238,18 +249,18 @@ int main(int argc, char** argv)
|
||||
geode->addDrawable( osg::createTexturedQuadGeometry(osg::Vec3(0.0f,characterSize*thickness,0.0f),osg::Vec3(characterSize,0.0,0.0),osg::Vec3(0.0f,0.0,characterSize), 0.0, 0.0, 1.0, 1.0) );
|
||||
}
|
||||
|
||||
if (arguments.read("--add-axes"))
|
||||
group->addChild(osgDB::readNodeFile("axes.osgt"));
|
||||
if (arguments.read("--add-axes"))
|
||||
group->addChild(osgDB::readNodeFile("axes.osgt"));
|
||||
|
||||
std::string mode;
|
||||
if (arguments.read("--character-size-mode", mode))
|
||||
{
|
||||
if (mode == "screen_coords")
|
||||
{
|
||||
text3D->setCharacterSizeMode(osgText::TextBase::SCREEN_COORDS);
|
||||
text3D->setCharacterSize(1080/4);
|
||||
}
|
||||
}
|
||||
std::string mode;
|
||||
if (arguments.read("--character-size-mode", mode))
|
||||
{
|
||||
if (mode == "screen_coords")
|
||||
{
|
||||
text3D->setCharacterSizeMode(osgText::TextBase::SCREEN_COORDS);
|
||||
text3D->setCharacterSize(1080/4);
|
||||
}
|
||||
}
|
||||
|
||||
viewer.addEventHandler(new Text3DAttributeHandler(text3D));
|
||||
}
|
||||
|
||||
@@ -517,9 +517,10 @@ void Program::apply( osg::State& state ) const
|
||||
// for shader debugging: to minimize performance impact,
|
||||
// optionally validate based on notify level.
|
||||
// TODO: enable this using notify level, or perhaps its own getenv()?
|
||||
#ifndef __APPLE__
|
||||
if( osg::isNotifyEnabled(osg::INFO) )
|
||||
pcp->validateProgram();
|
||||
|
||||
#endif
|
||||
pcp->useProgram();
|
||||
state.setLastAppliedProgramObject(pcp);
|
||||
}
|
||||
|
||||
@@ -136,9 +136,6 @@ bool RigTransformHardware::createPalette(int nbVertexes, BoneMap boneMap, const
|
||||
OSG_INFO << "RigTransformHardware::createPalette will use " << boneNameCountMap.size() * 4 << " uniforms" << std::endl;
|
||||
|
||||
|
||||
for (int i = 0 ; i < (int)vertexIndexWeight.size(); i++)
|
||||
vertexIndexWeight[i].resize(maxBonePerVertex);
|
||||
|
||||
_nbVertexes = nbVertexes;
|
||||
_bonesPerVertex = maxBonePerVertex;
|
||||
_bonePalette = palette;
|
||||
@@ -181,7 +178,7 @@ RigTransformHardware::BoneWeightAttribList RigTransformHardware::createVertexAtt
|
||||
int boneIndexInVec4 = b*2;
|
||||
(*array)[j][0 + boneIndexInVec4] = 0;
|
||||
(*array)[j][1 + boneIndexInVec4] = 0;
|
||||
if (boneIndexInList < getNumBonesPerVertex())
|
||||
if (boneIndexInList < _vertexIndexMatrixWeightList[j].size())
|
||||
{
|
||||
float boneIndex = static_cast<float>(_vertexIndexMatrixWeightList[j][boneIndexInList].getIndex());
|
||||
float boneWeight = _vertexIndexMatrixWeightList[j][boneIndexInList].getWeight();
|
||||
|
||||
@@ -438,9 +438,11 @@ void Text3D::computeGlyphRepresentation()
|
||||
{
|
||||
(*_coords)[i] += position;
|
||||
}
|
||||
_coords->dirty();
|
||||
|
||||
// copy normals
|
||||
_normals->insert(_normals->end(), src_normals->begin(), src_normals->end());
|
||||
_normals->dirty();
|
||||
|
||||
copyAndOffsetPrimitiveSets(_frontPrimitiveSetList, it->_glyphGeometry->getFrontPrimitiveSetList(), base);
|
||||
copyAndOffsetPrimitiveSets(_wallPrimitiveSetList, it->_glyphGeometry->getWallPrimitiveSetList(), base);
|
||||
|
||||
@@ -500,7 +500,7 @@ void LineSegmentIntersector::intersect(osgUtil::IntersectionVisitor& iv, osg::Dr
|
||||
if (reachedLimit()) return;
|
||||
|
||||
osg::Vec3d s(_start), e(_end);
|
||||
if ( !intersectAndClip( s, e, drawable->getBoundingBox() ) ) return;
|
||||
if ( drawable->isCullingActive() && !intersectAndClip( s, e, drawable->getBoundingBox() ) ) return;
|
||||
|
||||
if (iv.getDoDummyTraversal()) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user