[osg-users] Qt resouce and osgDB::readImageFile

2014-09-11 Thread Heiko Thiel
Hi,

I currently bind files wich our application need as resource. But is there a 
way, that osg automatically use the resource system (accept filepathes starting 
with qrc:/). Or how I can load a file from a qrc with something like 
readImageFile, where a filepathes is accepted, but I don't see an alternate 
with a stream?

Thank you!

Cheers,
Heiko

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61020#61020





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] CppCheck

2014-08-10 Thread Heiko Thiel
Hello,

I'm currently running CppCheck on our own project, which depends on osg. 
Therefore we are getting a lot of warnings related to osg. It is possible that 
someone whit a little bit more knowledge about osg take a look at it and fix 
them? There are many easy warnings (scope can be reduced or pass by reference), 
but also some where I don't know how they should be fixed in best way (e.g. 
warning not initialized in the constructor).

Regards
SunBlack

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=60615#60615





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Correct Size of boundingBox

2011-03-06 Thread Heiko Thiel
Hi,

I currently try to get correct height of a model. So I use a boundingBox. But 
my problem: it return the size without checking for a PositionAttitudeTransform.

My current hack is:


Code:
float getHeight(osg::Node* model) //return 1.4 on my example
{
float zMax;
osg::PositionAttitudeTransform* pat = 
dynamic_castosg::PositionAttitudeTransform*(model);

osg::ComputeBoundsVisitor boundsVisitor;
boundsVisitor.apply(*model);
osg::BoundingBox boundingBox = boundsVisitor.getBoundingBox();
if (pat)
{
osg::Vec3d scaleVec = pat-getScale();
zMax = boundingBox.zMax()*scaleVec.z();
}
else
{
zMax = boundingBox.zMax();
}

return zMax;
}



Is there a way to get correct bounding box without checking for 
PositionAttitudeTransform? I tried to optimize model before I check to remove 
the PositionAttitudeTransform. But it seems to not help.


Code:
float getHeight(osg::Node* model) //return 7.3 on my example
{
float zMax;
osgUtil::Optimizer optimizer;
optimizer.optimize(model);

osg::ComputeBoundsVisitor boundsVisitor;
boundsVisitor.apply(*model);
osg::BoundingBox boundingBox = boundsVisitor.getBoundingBox();
zMax = boundingBox.zMax();

return zMax;
}



Is there a clean solution?

Thank you!

Cheers,
Heiko

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=37368#37368





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Billboard with two layer

2011-03-05 Thread Heiko Thiel
Hi,

currently I create a healthbar for a minion. So I use a billboard for it. But 
now I have a problem: I want give the billboard a background. So I have 
following both gemoetries:

A colored border, filled with another which is a little bit transparent.

Code:

||
|  |
||




And the healthbar:


Code:

☐☐




Combined it should look like this:


Code:

||
|☐☐|
||




But how to combine it without flickering?

Currently I have (_createHealthGemoetry ist nearly the same like 
_createBackgroundGemoetry, but smaller so it fit into the other):


Code:
HealthBar::HealthBar()
{
this-setMode(osg::Billboard::POINT_ROT_EYE);

_health = 1;
_maxHealth = 1;
this-_setBillBoardStateSet();
this-addDrawable(_createBackgroundGemoetry());
this-addDrawable(_createHealthGemoetry());
}

void HealthBar::_setBillBoardStateSet()
{
osg::StateSet* billBoardStateSet = new osg::StateSet(); 
billBoardStateSet-setMode( GL_LIGHTING, osg::StateAttribute::OFF );
billBoardStateSet-setAttributeAndModes( new osg::BlendFunc, 
osg::StateAttribute::ON );
billBoardStateSet-setRenderingHint(osg::StateSet::TRANSPARENT_BIN);

// Make sure the geometry has the correct state
this-setStateSet(billBoardStateSet);
}

osg::Drawable* HealthBar::_createBackgroundGemoetry()
{
float width = 0.8f;
float height = 0.12f;

osg::Geometry* backgroundGeometry = new osg::Geometry();

osg::Texture2D* backgroundTexture = 
AssetLibrary::instance()-getTexture(healthbar/test.png);

// Declare and initialize geometry
backgroundGeometry = new osg::Geometry();

//add vertices and texture
osg::Vec3Array* verts = new osg::Vec3Array(4);  
(*verts)[0] = osg::Vec3( -width/2, 0, -height/2);
(*verts)[1] = osg::Vec3( +width/2, 0, -height/2);
(*verts)[2] = osg::Vec3( +width/2, 0, +height/2);
(*verts)[3] = osg::Vec3( -width/2, 0, +height/2);
backgroundGeometry-setVertexArray(verts);


osg::Vec2Array* texCoords = new osg::Vec2Array(4);
(*texCoords)[0].set(0.0f, 0.0f);
(*texCoords)[1].set(1.0f, 0.0f);
(*texCoords)[2].set(1.0f, 1.0f);
(*texCoords)[3].set(0.0f, 1.0f);
backgroundGeometry-setTexCoordArray(0, texCoords);

osg::StateSet* stateSet = new osg::StateSet();
stateSet-setTextureAttributeAndModes(0, backgroundTexture, 
osg::StateAttribute::ON);
backgroundGeometry-setStateSet(stateSet);

// Add a primitive set (QUADS) to the geometry
backgroundGeometry-addPrimitiveSet(new 
osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));

osg::Vec4Array* colors = new osg::Vec4Array;
colors-push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
backgroundGeometry-setColorArray(colors);
backgroundGeometry-setColorBinding(osg::Geometry::BIND_OVERALL);

return backgroundGeometry;
}



Thank you!

Cheers,
Heiko

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=37364#37364





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] LineSegmentIntersector which objects are returned?

2011-02-11 Thread Heiko Thiel
Hi Robert,


robertosfield wrote:
 Secondly the intersections you get returned return the leaf node and
 drawable that is intersected along with the node path from the root of
 the intersection traversal down to the leaf node that was intersected.


you found my problem: I forgot that the demo access only the leaf node, so I 
can solve may problem by searching right node on nodePath.

But I can't use nodePath like expected. To play a little bit with the nodePath 
I wanted to print all names of nodes

So my first try was:

Code:
bool nodeFound = false;
for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = 
intersections.begin(); hitr != intersections.end(); ++hitr)
{
  osg::NodePath path = hitr-nodePath;
  for(osg::NodePath::iterator hitNodeIt = path = hitr-nodePath.begin(); 
hitNodeIt != path = hitr-nodePath.end(); ++hitNodeIt)
  {
if (hitNodeIt-getName())
{
  nodeFound = true;
  std::cout  hitNodeIt-getName();
}
  }
  if (nodeFound) break;
}



Then I got:

 IntelliSense: Es ist keine passende benutzerdefinierte Konvertierung von  
 std::_Vector_const_iteratorstd::_Vector_valosg::Node *, 
 std::allocatorosg::Node * in 
 std::_Vector_iteratorstd::_Vector_valosg::Node *, 
 std::allocatorosg::Node * vorhanden.


So I tried this:

Code:
bool nodeFound = false;
for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = 
intersections.begin(); hitr != intersections.end(); ++hitr)
{
  for(osg::NodePath::const_iterator hitNodeIt = hitr-nodePath.begin(); 
hitNodeIt != hitr-nodePath.end(); ++hitNodeIt)
  {
if (hitNodeIt-getName())
{
  nodeFound = true;
  std::cout  hitNodeIt-getName();
}
  }
  if (nodeFound) break;
}


But this won't compile too:

 error C2039: 'getName': Ist kein Element von 
 'std::_Vector_const_iterator_Myvec'
 error C2839: Ungültiger Rückgabetyp 'osg::Node *const *' für überladenen 
 Operator '-'
 IntelliSense: Der Ausdruck muss den Typ pointer-to-class aufweisen.
 


Any idea?

Heiko

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36554#36554





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] LineSegmentIntersector which objects are returned?

2011-02-11 Thread Heiko Thiel
Hi,

you are right :). I tried this myself before and saw that VS show me 
nevertheless an error. But didnt seen that the error message changed (I had 
forgot the .empty() on comparism) ;)

Thank you!

Cheers,
Heiko

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36562#36562





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] LineSegmentIntersector which objects are returned?

2011-02-06 Thread Heiko Thiel
Hi,

I have a simple question to LineSegmentIntersector: Which objects can be 
intersect with the test ray?

I ask because I have following problem: I have following osg tree:

- Geode -Field
 - Node (Model loaded from disc) - Contains Name obj1 by Model (so not set 
by my - don't want to presume that the name is everytime same)
 - Geode (single quad of the ground of terrain) - Name: Ground
   - Geometry (4 vertices)

If I do now a klick I got following names returned: obj1, obj1, obj, ..., 
Ground (Model is a Firetree - many intersections). But never the name Field. 
So the problem is: I can't assume that the Model has name obj1. That is why I 
think I must additional geode around it with an extra class, so I can check 
with dynamic_cast if the test ray had found an interesting object or not. But 
this don't work, if I dont get the Field-Geode returned.

How to handle this problem? (osgPick-Demo is to simple to see a solution :( )

Thank you!

Cheers,
Heiko

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36399#36399





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] setNumMultiSamples not independ to setUpViewInWindow ?

2011-01-30 Thread Heiko Thiel
Hi,

I have wondered me on my project, why antialising, which I had activated, was 
broken. Now I found the resolution, but I don't know why this fixed it.

When I call:


Code:
_viewer.setUpViewInWindow( 100, 100, 1024, 768 );
osg::DisplaySettings::instance()-setNumMultiSamples(4);



it don't works. But if I use 


Code:
osg::DisplaySettings::instance()-setNumMultiSamples(4);
_viewer.setUpViewInWindow( 100, 100, 1024, 768 );



it works. But why? Or is it a bug?

Thank you!

Cheers,
Heiko

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36151#36151





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] [build] Can't compile own project as release build

2010-12-24 Thread Heiko Thiel
Hi,

since some SVN versions i'm not anymore able to compile my project as release 
build. Debug build works without problems.

I get following error by VS 2010:


 Fehler2   error LNK2001: Nicht aufgelöstes externes Symbol 
 public: virtual void __thiscall osg::BufferData::releaseGLObjects(class 
 osg::State *)const  (?releaseglobje...@bufferdata@osg@@ubexpavst...@2@@Z). 
 C:\Users\SunBlack\Desktop\GP\build\main.obj Towerdefense
 Fehler1   error LNK2001: Nicht aufgelöstes externes Symbol 
 public: virtual void __thiscall 
 osg::BufferData::resizeGLObjectBuffers(unsigned int) 
 (?resizeglobjectbuff...@bufferdata@osg@@ua...@z). 
 C:\Users\SunBlack\Desktop\GP\build\main.obj Towerdefense
 


Interesting is: Notepad++ found releaseglobje...@bufferdata in osgd.lib and 
osgrd.lib, but not in osg.lib and osgr.lib. Any idea why?


Thank you!

Cheers,
Heiko

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35148#35148





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [build] Can't compile own project as release build

2010-12-24 Thread Heiko Thiel
You are right. It looks like a mistaken by me. I had compile osg two times: 
Debug and RelWithDbgInfo. I had think, that Debug creates osgd.lib and 
RelWithDbgInfo osg.lib with additional debug files (pdm and so on). But it 
seems RelWithDbgInfo is not that, what I have expected, so I must compile 
RelWithDbgInfo and Release to get libs for both versions.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35152#35152





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org