Re: [osg-users] Generating multitouch events

2011-02-08 Thread Serge Lages
Hi,

Thanks for your replies, it confirms what I was thinking... The iOS way of
sending events seems to be an exception, all the touch technologies I use
(mostly MPX, Windows 7 and TUIO) send them separately, so I think it should
be useful to add to EventQueue a way to track the events to put them
altogether into the GUIEventAdapter, what do you think ?

Cheers,

On Mon, Feb 7, 2011 at 8:45 PM, Stephan Huber ratzf...@digitalmind.dewrote:

 Hi Glenn,

 Am 07.02.11 12:06, schrieb Serge Lages:
  I am currently working on getting multi-touch working on Linux with MPX
  (XInput2), and I would like to use this new system for my events. But
 with
  XInput (or also with Windows 7), I am receiving all the events
 separately,
  so what's the best approach to feed the
  touchesBegan/touchesMoved/touchesEnded methods ? Will I need to store
 each
  input state internally into the GraphicWindow class to set each time all
 the
  touch states ?

 You'll have to store your touch-points and submit them alltogether as
 one event to the eventqueue, here's some pseudo-code:

 osg::ref_ptrosgGA::GUIEventAdapter osg_event(NULL);
 for(int i = 0; i  numTouches; i++)
 {
  // get touch i and corrsponding phase, x and y
  ...
  // feed it to the osg_event
  if (!osg_event) {
osg_event = _win-getEventQueue()-touchBegan(i, phase, x, y);
  } else {
osg_event-addTouchPoint(i, phase, x, y);
  }
 }

 As Paul noticed in one of his recent mails, the design of the current
 implementation is not the easiest and cleanest,  but I was happy to have
 something working on my end. So if you have any improvements to the
 design/code, please share them with us, so we get a robust and clean
 multi-touch implementation working consistent on different platforms.

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




-- 
Serge Lages
http://www.tharsis-software.com
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] One more texture on earth

2011-02-08 Thread Sergey Bocharov
Hi!

I have model of earth and  2 maps as texture on it - daylight and night texture.
I need to load one more texture - for example  more detailed map of some region 
or city.  

How can I do it?

This is my code , which realizes  2 textures:


Code:

   sPlanetSphere-setVertexArray(coords);

osg::Vec3Array* normals = new osg::Vec3Array(numVertices);
sPlanetSphere-setNormalArray(normals);
sPlanetSphere-setNormalBinding(osg::Geometry::BIND_PER_VERTEX);

osg::Vec2Array* texcoords = new osg::Vec2Array(numVertices);
sPlanetSphere-setTexCoordArray(0,texcoords);
sPlanetSphere-setTexCoordArray(1,texcoords);

.

//NEW TEXTURE

// DAY
   osg::Image* image = 
osgDB::readImageFile(QString(QApplication::applicationDirPath()).toStdString()+/img/earth2048.jpg);

// osg::Image* image = osgDB::readImageFile(img/EarthMap_2500x1250.jpg);
  // osg::Image* image = osgDB::readImageFile(img/polit.jpg);

   if ( image ){
 osg::Texture2D* tex2d = new osg::Texture2D( image );
 tex2d-setWrap( osg::Texture::WRAP_S, osg::Texture::REPEAT );
 tex2d-setWrap( osg::Texture::WRAP_T, osg::Texture::REPEAT );
 sPlanetSphere-getOrCreateStateSet()-setTextureAttributeAndModes( 0, 
tex2d, osg::StateAttribute::ON );

}
   //NIGHT

 osg::Image* image1 = 
osgDB::readImageFile(QString(QApplication::applicationDirPath()).toStdString()+/img/land_ocean_ice_lights_2048.jpg);
if ( image1 )
{
osg::StateSet* stateset = sPlanetSphere-getOrCreateStateSet();

osg::TexEnvCombine* texenv = new osg::TexEnvCombine;

texenv-setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);//
texenv-setSource0_RGB(osg::TexEnvCombine::PREVIOUS);
texenv-setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv-setSource1_RGB(osg::TexEnvCombine::TEXTURE);
texenv-setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
texenv-setSource2_RGB(osg::TexEnvCombine::PRIMARY_COLOR);
texenv-setOperand2_RGB(osg::TexEnvCombine::SRC_COLOR);

stateset-setTextureAttribute( 1, texenv );
osg::Texture2D* tex2d1 = new osg::Texture2D( image1 );
tex2d1-setWrap( osg::Texture::WRAP_S, osg::Texture::REPEAT );
tex2d1-setWrap( osg::Texture::WRAP_T, osg::Texture::REPEAT );
stateset-setTextureAttributeAndModes( 1, tex2d1, 
osg::StateAttribute::ON );
}


//END OF TEXTURE






Thank you!

Cheers,
Sergey

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





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


Re: [osg-users] True Geometric Morph

2011-02-08 Thread Roland Smeenk
Hi Seth,

I implemented osgAnimation::MorphGeometry when I was working on the Collada 
importer and needed a way to store the morphing data inside a Collada file. The 
morphing algorithm is indeed very simple, but that's typically how morphing 
animations are exchanged in the 3D content pipeline. Feel free to look at 
adding a new morphing algorithm however.

BTW. I believe importing of morph data from Collada is currently broken in the 
SVN.

kind regards,

Roland

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





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


Re: [osg-users] True Geometric Morph

2011-02-08 Thread Robert Osfield
Hi Seth,

The OSG doesn't have this general morph capability that you are
looking for.  It's not something that is something that can easily be
done with blending geometries as you'd need as working out the
correspondence will be none trivial.

The way to tackle it would be to leverage the exisiting MorphGeometry
functionality that uses two geometries with the same number of
vertices and primitives to do the actual animation, these two end
geometries you'd compute from your source geometries.  With the source
geometries you'd need to insert vertices (and associated texcoords
etc) that correspond to both end geometries and split up primitives to
make a single geometry that can be morphed to be compatible with the
two end source points.  One will also need to handle any differences
in state in a compatible way - such as using multi-texturing to blend
between different textures.

The other way to approach it would be to using alpha blending to
blending between the two versions.  This is quite different effect
though, but will be more flexible in terms of handling different types
of objects and different types of state.

Robert.

On Mon, Feb 7, 2011 at 9:57 PM, Seth Berrier seth.berr...@gmail.com wrote:
 I'm looking to implement geometric morphing between two non-identical objects 
 (with different ploy and vertex counts).  I stumbled upon 
 osgAnimation::MorphGeometry and have been playing with it a bit but have come 
 to the conclusion that it cannot do something this general; that it 
 implements Morph Target Animation and not general geometric morphing.  Is 
 this correct?  I say this as all the examples given morph between objects 
 with identical vertex and poly counts.  Also, I see no mechanism in the 
 MorphGeometry class to establish correspondence points or vertex groupings 
 which would surely be necessary to solve this problem in general.

 The trick with morphing is mapping the vertices from one target to another.  
 That's kind of free when the targets are this similar (identical vertex 
 counts and identical vertex ordering for each object).  I'm interested in the 
 case where it's not obvious, where vertex counts are different and more 
 information is needed to create and control that mapping as the object is 
 tweened.

 Anyways, is there anything that solves this more general problem in OSG?  If 
 I were to implement this, would it be of interest to other (i.e. should I do 
 it in OSG and I should I do it carefully so that others could at least 
 attempt to take advantage of it ... as opposed to just hacking it together)  
 ;-)

 Seth

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





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

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


[osg-users] Keyboard move camera position

2011-02-08 Thread Nan WANG
Hi,
I've created my 3D scene, and now I want to move camera's position in this 
scene, using keyboard controlling, like using some key lik A, S, W, D to move 
the camera...

Is there any simple example of using keyboard handler? 
... 

Thank you!

Cheers,
Nan

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





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


Re: [osg-users] Keyboard move camera position

2011-02-08 Thread Alberto Luaces
Nan WANG writes:

 Hi,
 I've created my 3D scene, and now I want to move camera's position in this 
 scene, using keyboard controlling, like using some key lik A, S, W, D to move 
 the camera...

 Is there any simple example of using keyboard handler? 
 ... 

Take a look at osgGA::FirstPersonManipulator.
-- 
Alberto

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


Re: [osg-users] Keyboard move camera position

2011-02-08 Thread Nan WANG
hello
As i am newbie in OSG. ...could you tell me how to use FirstPersonManipulator 
in my scene?

I copied 'FirstPersonManipulator' from %SVN%\include\osgGA to my project 
folder, then add it in my project. then add '#include 
osgGA/FirstPersonManipulator' above main() functionthen
viewer.setCameraManipulator(new osgGA::FirstPersonManipulator());


then error like: 
error C2664: 'osgViewer::View::setCameraManipulator' : cannot convert parameter 
1 from 'osgGA::FirstPersonManipulator *' to 'osgGA::MatrixManipulator *'

do you know why?

Thank you!

Cheers,
Nan

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





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


Re: [osg-users] Keyboard move camera position

2011-02-08 Thread Alberto Luaces
Nan WANG writes:

 hello
 As i am newbie in OSG. ...could you tell me how to use FirstPersonManipulator 
 in my scene?

 I copied 'FirstPersonManipulator' from %SVN%\include\osgGA to my project 
 folder, then add it in my project. then add '#include 
 osgGA/FirstPersonManipulator' above main() functionthen
 viewer.setCameraManipulator(new osgGA::FirstPersonManipulator());


 then error like: 
 error C2664: 'osgViewer::View::setCameraManipulator' : cannot convert 
 parameter 1 from 'osgGA::FirstPersonManipulator *' to 
 'osgGA::MatrixManipulator *'

Which OSG version are you using? Can you post from which class is
FirstPersonManipulator inheriting in your copy?

-- 
Alberto

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


[osg-users] IFC to OSG converter

2011-02-08 Thread Peter Kilpatrick
Hello,

I am working on an IFC to OSG converter.

There are some screenshots at www.scenescript.com.

Regards,
Peter Kilpatrick___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] IFC to OSG converter

2011-02-08 Thread Sukender
Hi Peter,

Nice work! Is this a ReaderWriter or a standalone converter?

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/

- Peter Kilpatrick p...@scenescript.com a écrit :

 Hello,
 
 I am working on an IFC to OSG converter.
 
 There are some screenshots at www.scenescript.com .
 
 Regards,
 Peter Kilpatrick 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] IFC to OSG converter

2011-02-08 Thread Peter Kilpatrick

Hello Sukender,

It is a standalone program that reads an IFC file, displays the spatial 
structure tree and creates an OSG scene graph which can be output.
IFC files tend to be very large and take a long time to load so standalone 
is better. The resulting .ive files are much smaller and load much faster.


Regards,
Peter

- Original Message - 
From: Sukender suky0...@free.fr

To: OpenSceneGraph Users osg-users@lists.openscenegraph.org
Sent: Tuesday, February 08, 2011 2:47 PM
Subject: Re: [osg-users] IFC to OSG converter



Hi Peter,

Nice work! Is this a ReaderWriter or a standalone converter?

Sukender
PVLE - Lightweight cross-platform game engine - 
http://pvle.sourceforge.net/


- Peter Kilpatrick p...@scenescript.com a écrit :


Hello,

I am working on an IFC to OSG converter.

There are some screenshots at www.scenescript.com .

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

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



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


Re: [osg-users] IFC to OSG converter

2011-02-08 Thread Peter Amstutz
You probably still want to implement osgDB::ReaderWriter.  You can still
use a standalone import/export program that loads the IFC file using
osgDB::readNode() and saves to IVE using osgDB::writeNode(), such as
osgconv or your own specialized import and visualization tool.

On 2/8/2011 8:17 AM, Peter Kilpatrick wrote:
 Hello Sukender,

 It is a standalone program that reads an IFC file, displays the
 spatial structure tree and creates an OSG scene graph which can be
 output.
 IFC files tend to be very large and take a long time to load so
 standalone is better. The resulting .ive files are much smaller and
 load much faster.

 Regards,
 Peter

-- 
Peter Amstutz
Senior Software Engineer
Technology Solutions Experts
Natick, MA
02131

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


[osg-users] Forward declarations and ref_ptr members

2011-02-08 Thread Jesper D. Thomsen
Hi all, I'm trying to prune out the number of includes in my headers, in order 
to keep from including OSG in all parts of my application.
I have a couple of places where I would like to forward declare osg::ref_ptr, 
but so far I have had no success with that.
Specifically, I would like to forward declare:

osg::ref_ptrosg::Material
And
osg::ref_ptrosg::Node

I tried adding:

namespace osg
{
class Node;
class Material;
template typename T class ref_ptr;
};

To the header file as suggested in the thread titled Forward declared classes 
and ref_ptrs, but I'm still getting the following error:
error C2079: 'asg::ASGContainer::m_osgroot' uses undefined class 
'osg::ref_ptrT'

I searched a bit on the internet and saw that in Boost they had made some 
special additions to their reference counted pointer in order to enable forward 
declarations.
If osg::ref_ptr doesn't support forward declarations, I can of course refactor 
my classes a bit in order to control which ones include OSG, but I would prefer 
using the forward declaration.

Regards, and some forward declared thanks :)

Jesper D. Thomsen
AnyBody Technology A/S

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


Re: [osg-users] Forward declarations and ref_ptr members

2011-02-08 Thread SkullCheck
Would the pimpl algorithm be applicable to your situation if you want
to minimize compile time dependencies?

On Tue, Feb 8, 2011 at 2:50 PM, Jesper D. Thomsen j...@anybodytech.com wrote:
 Hi all, I’m trying to prune out the number of includes in my headers, in
 order to keep from including OSG in all parts of my application.
 I have a couple of places where I would like to forward declare
 osg::ref_ptr, but so far I have had no success with that.
 Specifically, I would like to forward declare:

 osg::ref_ptrosg::Material

 And

 osg::ref_ptrosg::Node



 I tried adding:



 namespace osg

 {

 class Node;

 class Material;

 template typename T class ref_ptr;

 };



 To the header file as suggested in the thread titled “Forward declared
 classes and ref_ptrs”, but I’m still getting the following error:

 error C2079: 'asg::ASGContainer::m_osgroot' uses undefined class
 'osg::ref_ptrT'



 I searched a bit on the internet and saw that in Boost they had made some
 special additions to their reference counted pointer in order to enable
 forward declarations.

 If osg::ref_ptr doesn’t support forward declarations, I can of course
 refactor my classes a bit in order to control which ones include OSG, but I
 would prefer using the forward declaration.



 Regards, and some forward declared thanks J



 Jesper D. Thomsen

 AnyBody Technology A/S



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


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


Re: [osg-users] Forward declarations and ref_ptr members

2011-02-08 Thread Jean-Sébastien Guay

Hi Jesper,


error C2079: 'asg::ASGContainer::m_osgroot' uses undefined class
'osg::ref_ptrT'


Template classes/methods need to be completely defined when they are 
used, so what you're trying won't work.


In addition to using the pimpl idiom which would completely solve your 
problem but might take some time to implement everywhere it would be 
needed, you could get by just including osg/ref_ptr and forward 
declaring the classes that will be contained in a ref_ptr. So instead of:


namespace osg
{
class Node;
class Material;
template typename T class ref_ptr;
};

you could do:

#include osg/ref_ptr

namespace osg
{
class Node;
class Material;
};

The ref_ptr header is small and if that is the only one included in most 
places then you've got 98% of what you wanted for much less effort than 
using pimpl everywhere. That said, if I were designing an OSG-based API 
today I would probably use pimpl from the start and keep my public 
interface independent of OSG as much as I can. But that's just a design 
preference, and when refactoring existing code the decisions are 
different...


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] True Geometric Morph

2011-02-08 Thread Seth Berrier
Well all right then!

I've got so much on my plate these days I have no idea if I'll get to this 
right away (or at all) but if I do, I think doing it in OSG is the way to go.  
I've got a good source on all the morphing research that came out of it's flash 
in the spotlight back in the 90's (Warping and morphing of graphical objects by 
Jonas Gomes) and OSG has all the foundational stuff like geometry loading and 
management, a solid animation framework and (my personal favorite) Qt 
integration!

I'll update if and when anything happens.  Thanks for the feedback!

Seth

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





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


Re: [osg-users] Generating multitouch events

2011-02-08 Thread Stephan Maximilian Huber
Hi Serge,

Am 08.02.11 09:12, schrieb Serge Lages:
 Thanks for your replies, it confirms what I was thinking... The iOS way of
 sending events seems to be an exception, all the touch technologies I use
 (mostly MPX, Windows 7 and TUIO) send them separately, so I think it should
 be useful to add to EventQueue a way to track the events to put them
 altogether into the GUIEventAdapter, what do you think ?

Sounds reasonable :) Perhaps it's a good idea to enhance/refactor the
TouchData-class, so you can use it as a storage for all your
touch-points and add a cloned copy via a GUIEventAdapter to the
event-queue... just an idea.



cheers,
Stephan

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


[osg-users] osgPPU HDR culled from certain angles?

2011-02-08 Thread Jean-Sébastien Guay

Hello all, hello Art :-)

I have been experimenting with osgPPU's HDR example, and it looks and 
works great for my purposes, and was even easy to integrate into my own 
app as a test. It's interesting how easy the code is to understand, 
given what it would have been without osgPPU (i.e. using OSG and all the 
render targets that the effect would have required).


I have one weird problem though. When looking around in my scene, at 
some camera angles the image stops updating and seems to just alternate 
between the two last rendered frames continuously. I still have control 
though, and if I rotate the camera again at one point it starts updating 
like normal again.


When the camera is positioned at different places, it takes different 
camera orientations for this to happen. But looking up towards the sky 
(+Z) always makes it happen. So it kind of looks like something is being 
culled in the scene graph which is causing this. I can't figure out what 
though, since I've looked through osgPPU's code and it looks to me that 
all the nodes (Units, Processor, etc.) have culling disabled (using 
setCullingActive(false) ).


I can't reproduce this in the osgPPU HDR example itself, of course. :-( 
So I'm not looking for a precise fix, but more some hints as to what to 
look for. I dumped the scene and the Processor to files, and can't see 
anything wrong - I've attached the ppu file for reference, but it's 
really just the one from the HDR example, minus the text PPUs.


Thanks in advance,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
osgPPU::Processor {
  osgPPU::UnitBypass {
UniqueID UnitBypass_0
name HDRBypass
isActive 1
inputTextureIndexForViewportReference 0

PPUOutput {
  PPU UnitInResampleOut_1
  PPU UnitInOut_2
}

osgPPU::ColorAttribute {
  UniqueID ColorAttribute_3
  UpdateCallback {
  }
  startTime 0
  endTime 0
  startColor 1 1 1 1
  endColor 1 1 1 1
}
  }
  osgPPU::UnitInResampleOut {
UniqueID UnitInResampleOut_1
name Resample
isActive 1
inputTextureIndexForViewportReference 0

PPUOutput {
  PPU UnitInOut_4
  PPU UnitInOut_5
}

osgPPU::ColorAttribute {
  UniqueID ColorAttribute_6
  UpdateCallback {
  }
  startTime 0
  endTime 0
  startColor 1 1 1 1
  endColor 1 1 1 1
}
inputBypass -1
outputInternalFormat GL_RGBA16F_ARB
outputTextureType TEXTURE_2D
outputFace 0
outputDepth 1
factorX 0.25
factorY 0.25
  }
  osgPPU::UnitInOut {
UniqueID UnitInOut_4
name ComputePixelLuminance
isActive 1
inputTextureIndexForViewportReference 0

PPUOutput {
  PPU UnitInMipmapOut_7
}

osgPPU::ShaderAttribute {
  name LuminanceShader
  GeometryVerticesOut 1
  GeometryInputType TRIANGLES
  GeometryOutputType TRIANGLE_STRIP
  num_shaders 1
  Shader {
type FRAGMENT
code {
  /*
   * Compute luminance values of the input texture.
   * So result will contain only luminance values per pixel.
   */
  
  // ---
  // Texture units used for texturing
  // ---
  uniform sampler2D texUnit0;
  
  
  /**
   **/
  void main(void)
  {
   // get color from the texture
  // JSG: Mult by 2.0 since our scene is normally rendered in LDR 
so it 
  // didn't come out bright enough
   vec4 texColor0 = texture2D(texUnit0, gl_TexCoord[0].st) * 2.0;
  
   // compute luminance and output
   gl_FragColor.xyz = vec3( texColor0.r * 0.2125 + texColor0.g * 
0.7154 + texColor0.b * 0.0721 );
   gl_FragColor.a = texColor0.a;
  }
}
  }
  maximalSupportedTextureUnits 8
  RefUniformPair {
Uniform {
  name texUnit0
  type sampler2D 1 IntArray 1
  {
0 
  }
}
StateAttribute ON
  }
}

osgPPU::ColorAttribute {
  UniqueID ColorAttribute_8
  UpdateCallback {
  }
  startTime 0
  endTime 0
  startColor 1 1 1 1
  endColor 1 1 1 1
}
inputBypass -1
outputInternalFormat GL_RGBA16F_ARB
outputTextureType TEXTURE_2D
outputFace 0
outputDepth 1
  }
  osgPPU::UnitInMipmapOut {
UniqueID UnitInMipmapOut_7
name ComputeSceneLuminance
isActive 1
inputTextureIndexForViewportReference 0

PPUOutput {
  PPU UnitInOut_5
  PPU UnitInOut_2
  PPU UnitInOut_9
}

osgPPU::ShaderAttribute {
  name LuminanceShaderMipmap
  GeometryVerticesOut 1
  GeometryInputType 

[osg-users] Shaders in StandardShadowMap

2011-02-08 Thread Werner Modenbach
Hi,

I suggest altering one line of the shader code of StandardShadowMap into:

(_mainFragmentShader)

color *= mix( colorAmbientEmissive, gl_Color + gl_SecondaryColor, 
DynamicShadow() );  \n

Otherwise no specular light is shown. 

Also it would be nice having a chance to using the existing shader code in a 
derived class and just add new functions i.e. for bump mapping without cut and 
paste the shader source code.

I suggest putting all the functions in separate shaders and leaving just a 
minimal main() function.
All shaders could go into a vector of shaders being loaded in the init 
function. This way it would be easy creating additional shaders (shader 
functions) and just slightly modify the main() function.
Is there any maintainer of the code? Otherwise I would try to do the 
alterations myself.

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


Re: [osg-users] True Geometric Morph

2011-02-08 Thread Seth Berrier
Okay, I did some reading and I think this should be fairly easy!  What we need 
is 'combinatorial compatibility' between the two targets (i.e. a 1 to 1 mapping 
between vertices and edges).  The book by Gomes et al. describes several ways 
to achieve this but the simplest one that doesn't require user interaction runs 
something like this:

 Project vertices onto common geometry with a known distance metric 
(unit sphere is a good 'catch-all' here).

 For each vertex in one target (either one), find the polygon in the 
other target that contains it (using the projected geometry) and add this new 
vertex, subdividing the polygon appropriately.

 Repeat for the other target.


Now, for every vertex in target A, there is a new vertex created in target B 
for it to map to (and vice-versa).  As a result, each target has the same 
number of vertices (the sum of the vertices in the original targets) and we 
know which one goes with witch.  To avoid any unnecessary vertex duplications, 
I envision a preliminary step where we search for matching vertices in the two 
targets before we start adding any (ones that project to the same point on the 
sphere, or nearly the same point).

Anyways, I think I'm going to implement the above with a spherical projection 
and see what I get.  I have no experience with OSG so I will probably do this 
outside of OSG for now and just save the adjusted target geometry to load into 
OSG for animation.  If someone more comfortable with the OSG code base wanted 
to work it into the MorphGeometry class that would be super (and probably more 
efficient than if I tried to do it).

I'll post whatever I come up with.

Cheers!
Seth[/list]

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





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


Re: [osg-users] Shaders in StandardShadowMap

2011-02-08 Thread Jean-Sébastien Guay

Hello Werner,


I suggest altering one line of the shader code of StandardShadowMap into:

(_mainFragmentShader)

color*=mix(colorAmbientEmissive,gl_Color+gl_SecondaryColor,
DynamicShadow());\n

Otherwise no specular light is shown.


Yes, Wojtek mentioned about a week ago that this was an oversight on his 
part, so please submit the whole modified file to osg-submissions.



Also it would be nice having a chance to using the existing shader code
in a derived class and just add new functions i.e. for bump mapping
without cut and paste the shader source code.

I suggest putting all the functions in separate shaders and leaving just
a minimal main() function.

All shaders could go into a vector of shaders being loaded in the init
function. This way it would be easy creating additional shaders (shader
functions) and just slightly modify the main() function.

Is there any maintainer of the code? Otherwise I would try to do the
alterations myself.


I would advise against doing this, for the simple fact that it would be 
an interface specific to that class, whereas other classes that need 
shaders might do things differently. I think it's easier to just set the 
shadow technique's shaders to NULL, and set whatever shaders you want on 
the scene. Note that you can also set shaders anywhere in the graph, so 
you could have nodes without normal mapping, others without shadows, 
etc. so setting all types of shaders on the shadow technique itself 
doesn't really make sense.


Eventually shader composition will be available in OSG, and we'll be 
able to hopefully have a coherent interface for adding and overriding 
shader parts in the scene graph. Until then I don't think it's useful to 
change this.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgWidgets and double click

2011-02-08 Thread Eduardo Poyart
Hello,

It seems like osgWidgets doesn't support double-click.

What would be a good way to implement it? Timing the clicks on my widget
manager doesn't work, because I always miss the second click. I think that
is because OSG's event handler is translating the second click into a
double-click and osgWidgets never gets informed about the double-click.

I'm willing to submit a patch for osgWidgets, but I would like some guidance
on the right direction.

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


Re: [osg-users] When / howto stop or remove animation path

2011-02-08 Thread vincent sauvage
Hi,

thank you, robert, for the advice.

i actually subclass AnimationPathCallback  and rewrite  operator as folows :
void CB_AnimationPonctuelle::operator() (osg::Node *node, osg::NodeVisitor *nv){
osg::AnimationPathCallback::operator()(node,nv);// méthode 
originale (de la classe de base)
if (getAnimationTime()_duree_animation) {
setPause(true);
}
}



to make the animation just one time, i  test  animation time againt callback 
time (maybe not the best solution but it work...)

My problem is to stop (or pause the callback) when this test is true
i tried to use setPause() method  but it do not pause anything :-( and callback 
keep on running 

how should i use this method setPaused() ?
is ther another issue to pause a callback ?

thanks a lot for your help

nb : i found mask approach in the folowing topic but i hope there exist a 
simplest way ...
t=3844


Thank you!

Cheers,
vincent

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





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


Re: [osg-users] When / howto stop or remove animation path

2011-02-08 Thread vincent sauvage
in fact, while i was writing last reply, i found one solution :
void CB_AnimationPonctuelle::operator() (osg::Node *node, osg::NodeVisitor *nv){
if (getPause()) { 
traverse(node, nv); 
return;
}
osg::AnimationPathCallback::operator()(node,nv);// méthode 
originale (de la classe de base)
if (getAnimationTime()_duree_animation) 
setPause(true);
}
 
it's maybe not efficient (surely less than mask) but it work.

one souldn't forget traverse to let update visitor go through children ...  




Thank you!

Cheers,
vincent

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





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