Re: [osg-users] to draw landscapes beginning from a matrix

2008-02-27 Thread aurora restivo

Hi!

I have used the example of osgterrain but, even if the skirt is not 
visualized anymore,

now my terrain is flat (as in the attached figure).
besides the colors should be used with the gradations, from the tallest 
altitude to the lowest.

how can I get these results?


Thanks
Aurora


Robert Osfield ha scritto:

Hi Aurora,

You code is going off on the wrong track.  Don't use ShapeDrawable
here at all, don't try returning a osg::Geode.  You should be
returning the osgTerrain::Terrain, this is the node you should be
concentrating.  Please look at the osgterrain example.

Robert.

On Feb 20, 2008 12:48 PM, aurora restivo [EMAIL PROTECTED] wrote:
  

Hi Robert,

I send you the code with the new changes... unfortunately the result
doesn't change...
the plan around the terrain has not disappeared.

the object terrainTechnique that you have recommended me is necessary to
color the terrain?

Thanks
Aurora



Robert Osfield ha scritto:


Hi Aurora,

To assign the no data value do:

   hfLayer-setValidDataOperator(new osgTerrain::NoDataValue(0.0f));

Also you shouldn't need a ShapeDrawable when you are using
osgTerrain::Terrain, but you will need to assign a TerrainTechnique
that will be used to render the terrain.  See osgterrain example.

Robert.

On Feb 20, 2008 10:51 AM, aurora restivo [EMAIL PROTECTED] wrote:

  

Hi!

I apologize but I have not understood well.
I have need to draw the ground that is in the file terrain.jpg without
the plan that is visualized around.
I don't understand as I must use the NoDataValue.

Besides I also have problems to color the terrain.
My objective is to draw a terrain with a casting of washes.

Can you recommend me a book where to find a good documentation for my
specific problem?

Thanks
Aurora Restivo.


inline: out.JPG#pragma once

#include osgTerrain/Terrain
#include osgTerrain/GeometryTechnique

#include osgGA/TrackballManipulator
#include osgGA/FlightManipulator
#include osgGA/DriveManipulator
#include osgGA/KeySwitchMatrixManipulator
#include osgGA/StateSetManipulator
#include osgGA/AnimationPathManipulator
#include osgGA/TerrainManipulator

class Morfologia
{
public:
Morfologia(void);
~Morfologia(void);

osgTerrain::Terrain* drawMorfologia();
};


#include .\morfologia.h
#include .\gestionematrix.h

#include iostream
#include cstdlib

#include osg/Vec3d
#include osg/Texture2D
#include osgDB/ReadFile


#include osgTerrain/Locator
#include osgTerrain/Terrain
#include osgTerrain/ValidDataOperator
#include osgTerrain/Layer
#include osgTerrain/GeometryTechnique

#include osgGA/TrackballManipulator
#include osgGA/FlightManipulator
#include osgGA/DriveManipulator
#include osgGA/KeySwitchMatrixManipulator
#include osgGA/StateSetManipulator
#include osgGA/AnimationPathManipulator
#include osgGA/TerrainManipulator


Morfologia::Morfologia(void)
{
}

Morfologia::~Morfologia(void)
{
}


osgTerrain::Terrain* Morfologia::drawMorfologia()
{
GestioneMatrix* g=new GestioneMatrix();

int** m= g-leggiFile(morf0.txt);

int** nicchia=g-leggiFile(nicchia0.txt);

int max= g-cercaMax(m);
int min= g-cercaMin(m);

osg::HeightField* hF = new osg::HeightField();
hF-allocate(296,410);

for(int i=0; i 410; i++)
{
for(int j=0; j296 ;j++)
{
if(m[i][j]!=0)
hF-setHeight(j,i, 
m[i][j]+nicchia[i][j]);
}
}

hF-setXInterval(41.0);
hF-setYInterval(29.6);

osg::Quat* quat=  new osg::Quat(0,0,180,45);
hF-setRotation(*quat); 


osgTerrain::Terrain* terrainNode= new osgTerrain::Terrain();
osgTerrain::HeightFieldLayer* hFLayer= new 
osgTerrain::HeightFieldLayer();
hFLayer-setHeightField(hF);


//LOCATOR
double x = 0.0;
double y = 0.0;
double w = 1.0;
double h = 1.0;

osgTerrain::Locator* locator = new osgTerrain::Locator;

locator-setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
locator-setTransformAsExtents(x, y, w, h);

hFLayer-setLocator(locator);
//fine locator

//GESTIONE DEGLI '0'
osgTerrain::ValidDataOperator* dataO= new 
osgTerrain::NoDataValue(0.0f);
hFLayer-setValidDataOperator(dataO);
//FINE GESTIONE DEGLI '0'

terrainNode-setElevationLayer(hFLayer);


Re: [osg-users] to draw landscapes beginning from a matrix

2008-02-27 Thread Robert Osfield
Hi Aurora,

Do you actually need the Locator that takes you into geocentric
coordinates?  I.e. are you looking for a flat earth projection or a
geocentric one?

Robert.

On Wed, Feb 27, 2008 at 11:46 AM, aurora restivo [EMAIL PROTECTED] wrote:
 Hi!

  I have used the example of osgterrain but, even if the skirt is not
  visualized anymore,
  now my terrain is flat (as in the attached figure).
  besides the colors should be used with the gradations, from the tallest
  altitude to the lowest.
  how can I get these results?




  Thanks
  Aurora


  Robert Osfield ha scritto:
   Hi Aurora,
  
   You code is going off on the wrong track.  Don't use ShapeDrawable
   here at all, don't try returning a osg::Geode.  You should be
   returning the osgTerrain::Terrain, this is the node you should be
   concentrating.  Please look at the osgterrain example.
  
   Robert.
  
   On Feb 20, 2008 12:48 PM, aurora restivo [EMAIL PROTECTED] wrote:
  
   Hi Robert,
  
   I send you the code with the new changes... unfortunately the result
   doesn't change...
   the plan around the terrain has not disappeared.
  
   the object terrainTechnique that you have recommended me is necessary to
   color the terrain?
  
   Thanks
   Aurora
  
  
  
   Robert Osfield ha scritto:
  
   Hi Aurora,
  
   To assign the no data value do:
  
  hfLayer-setValidDataOperator(new osgTerrain::NoDataValue(0.0f));
  
   Also you shouldn't need a ShapeDrawable when you are using
   osgTerrain::Terrain, but you will need to assign a TerrainTechnique
   that will be used to render the terrain.  See osgterrain example.
  
   Robert.
  
   On Feb 20, 2008 10:51 AM, aurora restivo [EMAIL PROTECTED] wrote:
  
  
   Hi!
  
   I apologize but I have not understood well.
   I have need to draw the ground that is in the file terrain.jpg without
   the plan that is visualized around.
   I don't understand as I must use the NoDataValue.
  
   Besides I also have problems to color the terrain.
   My objective is to draw a terrain with a casting of washes.
  
   Can you recommend me a book where to find a good documentation for my
   specific problem?
  
   Thanks
   Aurora Restivo.
  
  

 #pragma once

  #include osgTerrain/Terrain
  #include osgTerrain/GeometryTechnique

  #include osgGA/TrackballManipulator
  #include osgGA/FlightManipulator
  #include osgGA/DriveManipulator
  #include osgGA/KeySwitchMatrixManipulator
  #include osgGA/StateSetManipulator
  #include osgGA/AnimationPathManipulator
  #include osgGA/TerrainManipulator

  class Morfologia
  {
  public:
 Morfologia(void);
 ~Morfologia(void);

 osgTerrain::Terrain* drawMorfologia();
  };



 #include .\morfologia.h
  #include .\gestionematrix.h

  #include iostream
  #include cstdlib

  #include osg/Vec3d
  #include osg/Texture2D
  #include osgDB/ReadFile


  #include osgTerrain/Locator
  #include osgTerrain/Terrain
  #include osgTerrain/ValidDataOperator
  #include osgTerrain/Layer
  #include osgTerrain/GeometryTechnique

  #include osgGA/TrackballManipulator
  #include osgGA/FlightManipulator
  #include osgGA/DriveManipulator
  #include osgGA/KeySwitchMatrixManipulator
  #include osgGA/StateSetManipulator
  #include osgGA/AnimationPathManipulator
  #include osgGA/TerrainManipulator


 Morfologia::Morfologia(void)
 {
 }

 Morfologia::~Morfologia(void)
 {
 }


 osgTerrain::Terrain* Morfologia::drawMorfologia()
 {
 GestioneMatrix* g=new GestioneMatrix();

 int** m= g-leggiFile(morf0.txt);

 int** nicchia=g-leggiFile(nicchia0.txt);

 int max= g-cercaMax(m);
 int min= g-cercaMin(m);

 osg::HeightField* hF = new osg::HeightField();
 hF-allocate(296,410);

 for(int i=0; i 410; i++)
 {
 for(int j=0; j296 ;j++)
 {
 if(m[i][j]!=0)
 hF-setHeight(j,i, 
 m[i][j]+nicchia[i][j]);
 }
 }

 hF-setXInterval(41.0);
 hF-setYInterval(29.6);

 osg::Quat* quat=  new osg::Quat(0,0,180,45);
 hF-setRotation(*quat);


 osgTerrain::Terrain* terrainNode= new osgTerrain::Terrain();
 osgTerrain::HeightFieldLayer* hFLayer= new 
 osgTerrain::HeightFieldLayer();
 hFLayer-setHeightField(hF);


 //LOCATOR
 double x = 0.0;
 double y = 0.0;
 double w = 1.0;
 double h = 1.0;

 osgTerrain::Locator* locator = new osgTerrain::Locator;
 
 locator-setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
 locator-setTransformAsExtents(x, y, w, h);

 hFLayer-setLocator(locator);
 

Re: [osg-users] to draw landscapes beginning from a matrix

2008-02-27 Thread aurora restivo
I need to get the terrain as in the figure that I send you, but without 
visualizing the skirt.


Aurora


Robert Osfield ha scritto:

Hi Aurora,

Do you actually need the Locator that takes you into geocentric
coordinates?  I.e. are you looking for a flat earth projection or a
geocentric one?

Robert.

On Wed, Feb 27, 2008 at 11:46 AM, aurora restivo [EMAIL PROTECTED] wrote:
  

Hi!

 I have used the example of osgterrain but, even if the skirt is not
 visualized anymore,
 now my terrain is flat (as in the attached figure).
 besides the colors should be used with the gradations, from the tallest
 altitude to the lowest.
 how can I get these results?




 Thanks
 Aurora




inline: terrain.JPG___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] to draw landscapes beginning from a matrix

2008-02-21 Thread aurora restivo

Hi Robert,

I apologize for the trouble, but I don't understand of what file it has 
need the example of osgTerrain.


Thank you
Aurora Restivo



Robert Osfield ha scritto:

Hi Aurora,

You code is going off on the wrong track.  Don't use ShapeDrawable
here at all, don't try returning a osg::Geode.  You should be
returning the osgTerrain::Terrain, this is the node you should be
concentrating.  Please look at the osgterrain example.

Robert.

On Feb 20, 2008 12:48 PM, aurora restivo [EMAIL PROTECTED] wrote:
  

Hi Robert,

I send you the code with the new changes... unfortunately the result
doesn't change...
the plan around the terrain has not disappeared.

the object terrainTechnique that you have recommended me is necessary to
color the terrain?

Thanks
Aurora



Robert Osfield ha scritto:


Hi Aurora,

To assign the no data value do:

   hfLayer-setValidDataOperator(new osgTerrain::NoDataValue(0.0f));

Also you shouldn't need a ShapeDrawable when you are using
osgTerrain::Terrain, but you will need to assign a TerrainTechnique
that will be used to render the terrain.  See osgterrain example.

Robert.

On Feb 20, 2008 10:51 AM, aurora restivo [EMAIL PROTECTED] wrote:

  

Hi!

I apologize but I have not understood well.
I have need to draw the ground that is in the file terrain.jpg without
the plan that is visualized around.
I don't understand as I must use the NoDataValue.

Besides I also have problems to color the terrain.
My objective is to draw a terrain with a casting of washes.

Can you recommend me a book where to find a good documentation for my
specific problem?

Thanks
Aurora Restivo.



Robert Osfield ha scritto:




Hi Aurora,

I think what you are looking for is the osgTerrain::ValidDataOperator
that you can attach to your elevation layer via
Layer::setValidDataOperator(operator);

In include/osgTerrain/ValidDataOperator you'll find the NoDataValue
subclass which is probably what you want to use in your case.

Robert.

On Feb 19, 2008 12:33 PM, aurora restivo [EMAIL PROTECTED] wrote:


  

Hi!

the image jpg in enclosure, is the result of the terrain that I have
drawn beginning from the matrix of the altitudes.
I would want to know if a way exists for not visualizing the quotas
equal to 0.

the source code is found in the file morfologia.txt

Thanks in advance.
Aurora Restivo







#include .\morfologia.h
#include .\gestionematrix.h

#include iostream
#include cstdlib
#include osg/Shape
#include osg/ShapeDrawable
#include osgTerrain/Terrain
#include osgTerrain/ValidDataOperator
#include osgTerrain/Layer
#include osg/Texture2D
#include osgDB/ReadFile
#include osg/Vec3d



Morfologia::Morfologia(void)
{
}

Morfologia::~Morfologia(void)
{
}


osg::Geode* Morfologia::drawMorfologia()
{
GestioneMatrix* g=new GestioneMatrix();

int** m= g-leggiFile(morf0.txt);

int max= g-cercaMax(m);
int min= g-cercaMin(m);

osg::HeightField* hF = new osg::HeightField();
hF-allocate(296,410);

for(int i=0; i 410; i++)
{
for(int j=0; j296 ;j++)
{
if(m[i][j]!=0)
hF-setHeight(j,i, m[i][j]);
}
}

hF-setXInterval(41.0);
hF-setYInterval(29.6);

osg::Quat* quat=  new osg::Quat(0,0,180,45);
hF-setRotation(*quat);
//hF-setBorderWidth(1000);
//hF-setSkirtHeight(500);  //set altezza piano


osgTerrain::Terrain* terrainNode= new osgTerrain::Terrain();
osgTerrain::HeightFieldLayer* hFLayer= new 
osgTerrain::HeightFieldLayer();
hFLayer-setHeightField(hF);


osgTerrain::ValidDataOperator* dataO= new osgTerrain::NoDataValue(0.0);
hFLayer-setValidDataOperator(dataO);

terrainNode-setElevationLayer(hFLayer);

//terrainNode-setColorLayer(151,hFLayer);
//terrainNode-setColorFilter(0, osgTerrain::Terrain::Filter::LINEAR);

osg::Geode* geode= new osg::Geode();
osg::ShapeDrawable* draw= new osg::ShapeDrawable(hF);
geode-addDrawable(draw);


//TEXTURE
osg::StateSet* state= new osg::StateSet();
osg::Texture2D* texture= new osg::Texture2D();
texture-setDataVariance(osg::Object::DYNAMIC);
osg::Image* img= 
osgDB::readImageFile(C:/Programmi/OpenSceneGraph/data/Images/Saturn.TGA);
texture-setImage(img);
state-setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
//geode-setStateSet(state);
//FINE texture



return geode;
}
___
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] to draw landscapes beginning from a matrix

2008-02-21 Thread Alberto Luaces
From the location where you installed OSG source code, look at  the 
examples/osgterrain directory. You will find osgterrain.cpp.

El Thursday 21 February 2008 11:38:29 aurora restivo escribió:
 Hi Robert,

 I apologize for the trouble, but I don't understand of what file it has
 need the example of osgTerrain.

 Thank you
 Aurora Restivo

 Robert Osfield ha scritto:
  Hi Aurora,
 
  You code is going off on the wrong track.  Don't use ShapeDrawable
  here at all, don't try returning a osg::Geode.  You should be
  returning the osgTerrain::Terrain, this is the node you should be
  concentrating.  Please look at the osgterrain example.
 
  Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] to draw landscapes beginning from a matrix

2008-02-21 Thread aurora restivo

Yes, but the file .cpp needs a file to be performed.
What's this file?

Thanks
Aurora

Alberto Luaces ha scritto:
From the location where you installed OSG source code, look at  the 
examples/osgterrain directory. You will find osgterrain.cpp.


El Thursday 21 February 2008 11:38:29 aurora restivo escribió:
  

Hi Robert,

I apologize for the trouble, but I don't understand of what file it has
need the example of osgTerrain.

Thank you
Aurora Restivo

Robert Osfield ha scritto:


Hi Aurora,

You code is going off on the wrong track.  Don't use ShapeDrawable
here at all, don't try returning a osg::Geode.  You should be
returning the osgTerrain::Terrain, this is the node you should be
concentrating.  Please look at the osgterrain example.

Robert.
  

___
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] to draw landscapes beginning from a matrix

2008-02-20 Thread Robert Osfield
Hi Aurora,

To assign the no data value do:

   hfLayer-setValidDataOperator(new osgTerrain::NoDataValue(0.0f));

Also you shouldn't need a ShapeDrawable when you are using
osgTerrain::Terrain, but you will need to assign a TerrainTechnique
that will be used to render the terrain.  See osgterrain example.

Robert.

On Feb 20, 2008 10:51 AM, aurora restivo [EMAIL PROTECTED] wrote:
 Hi!

 I apologize but I have not understood well.
 I have need to draw the ground that is in the file terrain.jpg without
 the plan that is visualized around.
 I don't understand as I must use the NoDataValue.

 Besides I also have problems to color the terrain.
 My objective is to draw a terrain with a casting of washes.

 Can you recommend me a book where to find a good documentation for my
 specific problem?

 Thanks
 Aurora Restivo.



 Robert Osfield ha scritto:

  Hi Aurora,
 
  I think what you are looking for is the osgTerrain::ValidDataOperator
  that you can attach to your elevation layer via
  Layer::setValidDataOperator(operator);
 
  In include/osgTerrain/ValidDataOperator you'll find the NoDataValue
  subclass which is probably what you want to use in your case.
 
  Robert.
 
  On Feb 19, 2008 12:33 PM, aurora restivo [EMAIL PROTECTED] wrote:
 
  Hi!
 
  the image jpg in enclosure, is the result of the terrain that I have
  drawn beginning from the matrix of the altitudes.
  I would want to know if a way exists for not visualizing the quotas
  equal to 0.
 
  the source code is found in the file morfologia.txt
 
  Thanks in advance.
  Aurora Restivo
 
 
 
 


 int** m= g-leggiFile(morf0.txt);


 osg::HeightField* hF = new osg::HeightField();
 hF-allocate(296,410);

 for(int i=0; i 410; i++)
 {
 for(int j=0; j296 ;j++)
 {
 if(m[i][j]!=0)
 hF-setHeight(j,i, m[i][j]);
 else
 hF-setHeight(j,i, m[i][j]);
 }
 }

 hF-setXInterval(41.0);
 hF-setYInterval(29.6);

 osg::Quat* quat=  new osg::Quat(0,0,180,45);
 hF-setRotation(*quat);


 osgTerrain::Terrain* terrainNode= new osgTerrain::Terrain();
 osgTerrain::HeightFieldLayer* hFLayer= new 
 osgTerrain::HeightFieldLayer();

 hFLayer-setHeightField(hF);
 terrainNode-setElevationLayer(hFLayer);



 osg::Geode* geode= new osg::Geode();
 osg::ShapeDrawable* draw= new osg::ShapeDrawable(hF);
 geode-addDrawable(draw);
 ___
 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] to draw landscapes beginning from a matrix

2008-02-20 Thread aurora restivo

Hi Robert,

I send you the code with the new changes... unfortunately the result 
doesn't change...

the plan around the terrain has not disappeared.

the object terrainTechnique that you have recommended me is necessary to 
color the terrain?


Thanks
Aurora


Robert Osfield ha scritto:

Hi Aurora,

To assign the no data value do:

   hfLayer-setValidDataOperator(new osgTerrain::NoDataValue(0.0f));

Also you shouldn't need a ShapeDrawable when you are using
osgTerrain::Terrain, but you will need to assign a TerrainTechnique
that will be used to render the terrain.  See osgterrain example.

Robert.

On Feb 20, 2008 10:51 AM, aurora restivo [EMAIL PROTECTED] wrote:
  

Hi!

I apologize but I have not understood well.
I have need to draw the ground that is in the file terrain.jpg without
the plan that is visualized around.
I don't understand as I must use the NoDataValue.

Besides I also have problems to color the terrain.
My objective is to draw a terrain with a casting of washes.

Can you recommend me a book where to find a good documentation for my
specific problem?

Thanks
Aurora Restivo.



Robert Osfield ha scritto:



Hi Aurora,

I think what you are looking for is the osgTerrain::ValidDataOperator
that you can attach to your elevation layer via
Layer::setValidDataOperator(operator);

In include/osgTerrain/ValidDataOperator you'll find the NoDataValue
subclass which is probably what you want to use in your case.

Robert.

On Feb 19, 2008 12:33 PM, aurora restivo [EMAIL PROTECTED] wrote:

  

Hi!

the image jpg in enclosure, is the result of the terrain that I have
drawn beginning from the matrix of the altitudes.
I would want to know if a way exists for not visualizing the quotas
equal to 0.

the source code is found in the file morfologia.txt

Thanks in advance.
Aurora Restivo







#include .\morfologia.h
#include .\gestionematrix.h

#include iostream
#include cstdlib
#include osg/Shape
#include osg/ShapeDrawable
#include osgTerrain/Terrain
#include osgTerrain/ValidDataOperator
#include osgTerrain/Layer
#include osg/Texture2D
#include osgDB/ReadFile
#include osg/Vec3d



Morfologia::Morfologia(void)
{
}

Morfologia::~Morfologia(void)
{
}


osg::Geode* Morfologia::drawMorfologia()
{
GestioneMatrix* g=new GestioneMatrix();

int** m= g-leggiFile(morf0.txt);

int max= g-cercaMax(m);
int min= g-cercaMin(m);

osg::HeightField* hF = new osg::HeightField();
hF-allocate(296,410);

for(int i=0; i 410; i++)
{
for(int j=0; j296 ;j++)
{
if(m[i][j]!=0)
hF-setHeight(j,i, m[i][j]);
}
}

hF-setXInterval(41.0);
hF-setYInterval(29.6);

osg::Quat* quat=  new osg::Quat(0,0,180,45);
hF-setRotation(*quat); 
//hF-setBorderWidth(1000);
//hF-setSkirtHeight(500);  //set altezza piano


osgTerrain::Terrain* terrainNode= new osgTerrain::Terrain();
osgTerrain::HeightFieldLayer* hFLayer= new 
osgTerrain::HeightFieldLayer();
hFLayer-setHeightField(hF);


osgTerrain::ValidDataOperator* dataO= new osgTerrain::NoDataValue(0.0);
hFLayer-setValidDataOperator(dataO);

terrainNode-setElevationLayer(hFLayer);

//terrainNode-setColorLayer(151,hFLayer);
//terrainNode-setColorFilter(0, osgTerrain::Terrain::Filter::LINEAR);

osg::Geode* geode= new osg::Geode();
osg::ShapeDrawable* draw= new osg::ShapeDrawable(hF);
geode-addDrawable(draw);


//TEXTURE
osg::StateSet* state= new osg::StateSet();
osg::Texture2D* texture= new osg::Texture2D();
texture-setDataVariance(osg::Object::DYNAMIC);
osg::Image* img= 
osgDB::readImageFile(C:/Programmi/OpenSceneGraph/data/Images/Saturn.TGA);
texture-setImage(img);
state-setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
//geode-setStateSet(state);
//FINE texture



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


Re: [osg-users] to draw landscapes beginning from a matrix

2008-02-20 Thread Robert Osfield
Hi Aurora,

You code is going off on the wrong track.  Don't use ShapeDrawable
here at all, don't try returning a osg::Geode.  You should be
returning the osgTerrain::Terrain, this is the node you should be
concentrating.  Please look at the osgterrain example.

Robert.

On Feb 20, 2008 12:48 PM, aurora restivo [EMAIL PROTECTED] wrote:
 Hi Robert,

 I send you the code with the new changes... unfortunately the result
 doesn't change...
 the plan around the terrain has not disappeared.

 the object terrainTechnique that you have recommended me is necessary to
 color the terrain?

 Thanks
 Aurora



 Robert Osfield ha scritto:
  Hi Aurora,
 
  To assign the no data value do:
 
 hfLayer-setValidDataOperator(new osgTerrain::NoDataValue(0.0f));
 
  Also you shouldn't need a ShapeDrawable when you are using
  osgTerrain::Terrain, but you will need to assign a TerrainTechnique
  that will be used to render the terrain.  See osgterrain example.
 
  Robert.
 
  On Feb 20, 2008 10:51 AM, aurora restivo [EMAIL PROTECTED] wrote:
 
  Hi!
 
  I apologize but I have not understood well.
  I have need to draw the ground that is in the file terrain.jpg without
  the plan that is visualized around.
  I don't understand as I must use the NoDataValue.
 
  Besides I also have problems to color the terrain.
  My objective is to draw a terrain with a casting of washes.
 
  Can you recommend me a book where to find a good documentation for my
  specific problem?
 
  Thanks
  Aurora Restivo.
 
 
 
  Robert Osfield ha scritto:
 
 
  Hi Aurora,
 
  I think what you are looking for is the osgTerrain::ValidDataOperator
  that you can attach to your elevation layer via
  Layer::setValidDataOperator(operator);
 
  In include/osgTerrain/ValidDataOperator you'll find the NoDataValue
  subclass which is probably what you want to use in your case.
 
  Robert.
 
  On Feb 19, 2008 12:33 PM, aurora restivo [EMAIL PROTECTED] wrote:
 
 
  Hi!
 
  the image jpg in enclosure, is the result of the terrain that I have
  drawn beginning from the matrix of the altitudes.
  I would want to know if a way exists for not visualizing the quotas
  equal to 0.
 
  the source code is found in the file morfologia.txt
 
  Thanks in advance.
  Aurora Restivo
 
 
 
 
 


 #include .\morfologia.h
 #include .\gestionematrix.h

 #include iostream
 #include cstdlib
 #include osg/Shape
 #include osg/ShapeDrawable
 #include osgTerrain/Terrain
 #include osgTerrain/ValidDataOperator
 #include osgTerrain/Layer
 #include osg/Texture2D
 #include osgDB/ReadFile
 #include osg/Vec3d



 Morfologia::Morfologia(void)
 {
 }

 Morfologia::~Morfologia(void)
 {
 }


 osg::Geode* Morfologia::drawMorfologia()
 {
 GestioneMatrix* g=new GestioneMatrix();

 int** m= g-leggiFile(morf0.txt);

 int max= g-cercaMax(m);
 int min= g-cercaMin(m);

 osg::HeightField* hF = new osg::HeightField();
 hF-allocate(296,410);

 for(int i=0; i 410; i++)
 {
 for(int j=0; j296 ;j++)
 {
 if(m[i][j]!=0)
 hF-setHeight(j,i, m[i][j]);
 }
 }

 hF-setXInterval(41.0);
 hF-setYInterval(29.6);

 osg::Quat* quat=  new osg::Quat(0,0,180,45);
 hF-setRotation(*quat);
 //hF-setBorderWidth(1000);
 //hF-setSkirtHeight(500);  //set altezza piano


 osgTerrain::Terrain* terrainNode= new osgTerrain::Terrain();
 osgTerrain::HeightFieldLayer* hFLayer= new 
 osgTerrain::HeightFieldLayer();
 hFLayer-setHeightField(hF);


 osgTerrain::ValidDataOperator* dataO= new 
 osgTerrain::NoDataValue(0.0);
 hFLayer-setValidDataOperator(dataO);

 terrainNode-setElevationLayer(hFLayer);

 //terrainNode-setColorLayer(151,hFLayer);
 //terrainNode-setColorFilter(0, osgTerrain::Terrain::Filter::LINEAR);

 osg::Geode* geode= new osg::Geode();
 osg::ShapeDrawable* draw= new osg::ShapeDrawable(hF);
 geode-addDrawable(draw);


 //TEXTURE
 osg::StateSet* state= new osg::StateSet();
 osg::Texture2D* texture= new osg::Texture2D();
 texture-setDataVariance(osg::Object::DYNAMIC);
 osg::Image* img= 
 osgDB::readImageFile(C:/Programmi/OpenSceneGraph/data/Images/Saturn.TGA);
 texture-setImage(img);
 state-setTextureAttributeAndModes(0, texture, 
 osg::StateAttribute::ON);
 //geode-setStateSet(state);
 //FINE texture



 return geode;
 }
 ___
 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] to draw landscapes beginning from a matrix

2008-02-19 Thread aurora restivo


Hi!

the image jpg in enclosure, is the result of the terrain that I have 
drawn beginning from the matrix of the altitudes.
I would want to know if a way exists for not visualizing the quotas 
equal to 0.


the source code is found in the file morfologia.txt

Thanks in advance.
Aurora Restivo




Jean-Christophe Lombardo ha scritto:

Hi,

You should have look to the osgshape example source code 
(http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgshape/osgshape.cpp)


jcl




 
 


This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
viruses.




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

  






inline: terrain.JPGint** m= g-leggiFile(morf0.txt);


osg::HeightField* hF = new osg::HeightField();
hF-allocate(296,410);

for(int i=0; i 410; i++)
{
for(int j=0; j296 ;j++)
{
if(m[i][j]!=0)
hF-setHeight(j,i, m[i][j]);
else
hF-setHeight(j,i, m[i][j]);
}
}

hF-setXInterval(41.0);
hF-setYInterval(29.6);

osg::Quat* quat=  new osg::Quat(0,0,180,45);
hF-setRotation(*quat); 


osgTerrain::Terrain* terrainNode= new osgTerrain::Terrain();
osgTerrain::HeightFieldLayer* hFLayer= new 
osgTerrain::HeightFieldLayer();

hFLayer-setHeightField(hF);
terrainNode-setElevationLayer(hFLayer);



osg::Geode* geode= new osg::Geode();
osg::ShapeDrawable* draw= new osg::ShapeDrawable(hF);
geode-addDrawable(draw);

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


Re: [osg-users] to draw landscapes beginning from a matrix

2008-02-19 Thread Robert Osfield
Hi Aurora,

I think what you are looking for is the osgTerrain::ValidDataOperator
that you can attach to your elevation layer via
Layer::setValidDataOperator(operator);

In include/osgTerrain/ValidDataOperator you'll find the NoDataValue
subclass which is probably what you want to use in your case.

Robert.

On Feb 19, 2008 12:33 PM, aurora restivo [EMAIL PROTECTED] wrote:

 Hi!

 the image jpg in enclosure, is the result of the terrain that I have
 drawn beginning from the matrix of the altitudes.
 I would want to know if a way exists for not visualizing the quotas
 equal to 0.

 the source code is found in the file morfologia.txt

 Thanks in advance.
 Aurora Restivo




 Jean-Christophe Lombardo ha scritto:
  Hi,
 
  You should have look to the osgshape example source code
  (http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgshape/osgshape.cpp)
 
  jcl
 
 
 
 
 
 
  
  This footnote confirms that this email message has been scanned by
  PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
  viruses.
  
 
 
 
  ___
  osg-users mailing list
  osg-users@lists.openscenegraph.org
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
 






 int** m= g-leggiFile(morf0.txt);


 osg::HeightField* hF = new osg::HeightField();
 hF-allocate(296,410);

 for(int i=0; i 410; i++)
 {
 for(int j=0; j296 ;j++)
 {
 if(m[i][j]!=0)
 hF-setHeight(j,i, m[i][j]);
 else
 hF-setHeight(j,i, m[i][j]);
 }
 }

 hF-setXInterval(41.0);
 hF-setYInterval(29.6);

 osg::Quat* quat=  new osg::Quat(0,0,180,45);
 hF-setRotation(*quat);


 osgTerrain::Terrain* terrainNode= new osgTerrain::Terrain();
 osgTerrain::HeightFieldLayer* hFLayer= new 
 osgTerrain::HeightFieldLayer();

 hFLayer-setHeightField(hF);
 terrainNode-setElevationLayer(hFLayer);



 osg::Geode* geode= new osg::Geode();
 osg::ShapeDrawable* draw= new osg::ShapeDrawable(hF);
 geode-addDrawable(draw);


 ___
 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] to draw landscapes beginning from a matrix

2008-02-08 Thread aurora restivo

Hi!

the image jpg in enclosure, is the result of the terrain that I have 
drawn beginning from the matrix of the altitudes.
I would want to know if a way exists for not visualizing the quotas 
equal to 0.


the source code is found in the file morfologia.txt

Thanks in advance.
Aurora Restivo




Jean-Christophe Lombardo ha scritto:

Hi,

You should have look to the osgshape example source code 
(http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgshape/osgshape.cpp)


jcl




 
 


This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
viruses.




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

  


inline: terrain.JPGint** m= g-leggiFile(morf0.txt);


osg::HeightField* hF = new osg::HeightField();
hF-allocate(296,410);

for(int i=0; i 410; i++)
{
for(int j=0; j296 ;j++)
{
if(m[i][j]!=0)
hF-setHeight(j,i, m[i][j]);
else
hF-setHeight(j,i, m[i][j]);
}
}

hF-setXInterval(41.0);
hF-setYInterval(29.6);

osg::Quat* quat=  new osg::Quat(0,0,180,45);
hF-setRotation(*quat); 


osgTerrain::Terrain* terrainNode= new osgTerrain::Terrain();
osgTerrain::HeightFieldLayer* hFLayer= new 
osgTerrain::HeightFieldLayer();

hFLayer-setHeightField(hF);
terrainNode-setElevationLayer(hFLayer);



osg::Geode* geode= new osg::Geode();
osg::ShapeDrawable* draw= new osg::ShapeDrawable(hF);
geode-addDrawable(draw);___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] to draw landscapes beginning from a matrix

2008-02-06 Thread Jean-Christophe Lombardo
Hi,

You should have look to the osgshape example source code 
(http://www.openscenegraph.org/projects/osg/browser/OpenSceneGraph/trunk/examples/osgshape/osgshape.cpp)

jcl




 
 

This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
viruses.




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


Re: [osg-users] to draw landscapes beginning from a matrix

2008-02-04 Thread aurora restivo

thanks for the satisfactory answer.
I have tried to study his solution but it is difficult for the lack of 
complete documentation.

I can try to explain better the problem:
I have a matrix of altitudes 410 X 296, I would want to represent her 
first in 2 dimensions (to color of white the smaller altitude and of 
black the greatest altitude),

then to represent her in 3 dimensions.
the purpose is to draw a volcanic ground for the simulation of castings 
of it washes.

can you help me to understand as I must proceed?
do you have some example of use of osg::HeightField and osg::Terrain?
thanks in advance

Aurora Restivo

-
From: Jean-Christophe Lombardo [EMAIL PROTECTED] 
http://gmane.org/get-address.php?address=jean%2dchristophe.lombardo%2dAYb5Cdd1jaQ%40public.gmane.org
Subject: Re: to draw landscapes beginning from a matrix 
http://news.gmane.org/find-root.php?message_id=%3c47A1E355.4000707%40cstb.fr%3e
Newsgroups: gmane.comp.graphics.openscenegraph.user 
http://news.gmane.org/gmane.comp.graphics.openscenegraph.user

Date: 2008-01-31 15:03:49 GMT (4 days and 3 minutes ago)

You might either
*  build an osg::HeightField 
(http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a01227.html) 
and draw it with an osgTerrain::TerrainNode node with an 
osgTerrain::HeightFieldLayer as an elevation layer
* or use VirtualPlanetBuilder 
(http://www.openscenegraph.org/projects/VirtualPlanetBuilder)


jcl

aurora restivo wrote:

Hi!

I have necessity to draw landscapes beginning from a matrix that 
contains the data of the altitude.


can you help me?

Thanks.
Aurora Restivo




___
osg-users mailing list
[EMAIL PROTECTED] 
http://gmane.org/get-address.php?address=osg%2dusers%2dZwoEplunGu0hajLcUbyfC12AsgEQdTeF%40public.gmane.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] to draw landscapes beginning from a matrix

2008-01-31 Thread Jean-Christophe Lombardo
You might either
*  build an osg::HeightField 
(http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a01227.html)
 
and draw it with an osgTerrain::TerrainNode node with an 
osgTerrain::HeightFieldLayer as an elevation layer
* or use VirtualPlanetBuilder 
(http://www.openscenegraph.org/projects/VirtualPlanetBuilder)

jcl

aurora restivo wrote:
 Hi!

 I have necessity to draw landscapes beginning from a matrix that 
 contains the data of the altitude.

 can you help me?

 Thanks.
 Aurora Restivo




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



  
  
 
 This footnote confirms that this email message has been scanned by
 PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
 viruses.
 



   


-- 
Jean-Christophe Lombardo  - Salle Immersive Le Corbusier
http://salle-immersive.cstb.fr
EVE / Centre Scientifique et Technique du Batiment
290 route des Lucioles - BP 209 - 06904 Sophia Antipolis - France 




 
 

This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
viruses.




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


Re: [osg-users] to draw landscapes beginning from a matrix

2008-01-31 Thread Stephen Northcott
Hi Aurora,

 From the generality of your question I would suggest you first go  
look at the Virtual Terrain Project web site..
It's an awesome source of info.

http://www.vterrain.org/

Kind regards,
Stephen.

On Jan 31, 2008, at 9:32 PM, aurora restivo wrote:



 Hi!

 I have necessity to draw landscapes beginning from a matrix that
 contains the data of the altitude.

 can you help me?

 Thanks.
 Aurora Restivo




 ___
 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