OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Add fixed vertical offset to survey layer


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
adrianj
Newbie


Joined: 19 Jan 2018
Posts: 7

PostPosted: Mon Jan 29, 2018 11:04 pm    Post subject:
Add fixed vertical offset to survey layer
Reply with quote

Hi,

I have an application where I have a base layer and a survey layer overload using OSG Earth. I then add other objects on top.

I would like to change my survey layer to have a fixed vertical offset of -1m. Basically lowering the survey layer so the other objects don't sit exactly on the surface. It has to be this way around as the position of the objects is more important relative to other items than to the survey layer.

What is the best method to do this? Could somebody provide a simple code example? This is my current code:


Code:

osgEarth::MapOptions mapOptions;
mapOptions.coordSysType() = osgEarth::MapOptions::CSTYPE_GEOCENTRIC;
_map = new osgEarth::Map(mapOptions);

GDALOptions gdalOptElevation;
gdalOptElevation.url() = url;
elevationLayer = new ElevationLayer(name, gdalOptElevation);
_map->addElevationLayer(elevationLayer);



Many thanks for your help!

Adrian
Back to top
View user's profile Send private message
Chris Hanson
Guest





PostPosted: Tue Jan 30, 2018 6:06 am    Post subject:
Add fixed vertical offset to survey layer
Reply with quote

Would the vertical offset do what you want?

https://github.com/gwaldron/osgearth/blob/master/src/osgEarth/TerrainOptions#L51



Depends on how your objects are clamped to the surface.


On Mon, Jan 29, 2018 at 4:04 PM, Adrian Jelffs < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi,

I have an application where I have a base layer and a survey layer overload using OSG Earth. I then add other objects on top.

I would like to change my survey layer to have a fixed vertical offset of -1m. Basically lowering the survey layer so the other objects don't sit exactly on the surface. It has to be this way around as the position of the objects is more important relative to other items than to the survey layer.

What is the best method to do this? Could somebody provide a simple code example? This is my current code:



Code:

osgEarth::MapOptions mapOptions;
mapOptions.coordSysType() = osgEarth::MapOptions::CSTYPE_GEOCENTRIC;
_map = new osgEarth::Map(mapOptions);

GDALOptions gdalOptElevation;
gdalOptElevation.url() = url;
elevationLayer = new ElevationLayer(name, gdalOptElevation);
_map->addElevationLayer(elevationLayer);




Many thanks for your help!

Adrian

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
Chris 'Xenon' Hanson, omo sanza lettere. http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Legal/IP • Forensics • Imaging • UAVs • GIS • GPS • osgEarth • Terrain • Telemetry • Cryptography • LIDAR • Embedded • Mobile • iPhone/iPad/iOS • Android
@alphapixel facebook.com/alphapixel (775) 623-PIXL [7495]

------------------
Post generated by Mail2Forum
Back to top
adrianj
Newbie


Joined: 19 Jan 2018
Posts: 7

PostPosted: Tue Jan 30, 2018 9:48 pm    Post subject:
Reply with quote

Chris,

That worked great!! Thank you for the link, I just couldn't find it in the documentation.

This is my example code:

Code:

osgEarth::TerrainOptions terrainOptions;
terrainOptions.verticalOffset() = -5;
mapNodeOptions.setTerrainOptions(terrainOptions);
_mapNode = new MapNode(_map, mapNodeOptions);


Cheers

Adrian
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts How to generate fixed alpha value? xdfanfan General 1 Sun Nov 19, 2017 4:12 pm View latest post
No new posts osg::Program::isFixedFunction() shoul... Mathieu Submission 1 Mon Aug 28, 2017 8:49 am View latest post
No new posts OpenSceneGraph static linking for And... tanshihaj Build system [build] 1 Sun Aug 13, 2017 10:09 pm View latest post
No new posts sKyBox offset arfaa General 0 Mon Jul 31, 2017 9:08 am View latest post
No new posts Multi layer effect rendering problem ... not3not4 General 0 Wed Jul 19, 2017 9:44 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP