Terrain verticalscale in osgEarth 3.0 (c++ code)

classic Classic list List threaded Threaded
3 messages Options
MCA4213 MCA4213
Reply | Threaded
Open this post in threaded view
|

Terrain verticalscale in osgEarth 3.0 (c++ code)

Hi, I want to create a vertical scale effect for my terrain.
I have tried the .earth file with osgearth_toc and it works.
Now I want to do it using c++ code, but I cannot find a way for that. the code that exist in the example is so old and not working.

I have tried this code but without a success:
                        Config conf;
                        conf.fromXML(std::stringstream(
                                "<uniform name= \"scale\" value=\"20\"/> \n"
                                "<code> \n"
                                "< ![CDATA[ \n"
                                "#pragma vp_entryPoint applyScale \n"
                                "#pragma vp_location vertex_view \n"

                                "uniform float scale; \n"
                                "vec4 oe_layer_tilec; \n"
                                "vec3 oe_UpVectorView; \n"
                                "float oe_terrain_getElevation(in vec2); \n"

                                "void applyScale(inout vec4 vertexView) \n"
                                "{ \n"
                                " float e = oe_terrain_getElevation(oe_layer_tilec.st); \n"
                                " vertexView.xyz += oe_UpVectorView*e*(scale-1.0); \n"
                                "} \n"
                                "]]> \n"
                                "</code> \n"));
                        Extension* ext = Extension::create("terrainshader", conf);
                        mapNode->addExtension(ext);
                        ExtensionInterface<osg::View>* viewIF = ExtensionInterface<osg::View>::get(ext);
                        if (viewIF) viewIF->connect(view);

Any help please?
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Terrain verticalscale in osgEarth 3.0 (c++ code)

Which example are you referring to (that is not working)?
Glenn Waldron / Pelican Mapping
MCA4213 MCA4213
Reply | Threaded
Open this post in threaded view
|

Re: Terrain verticalscale in osgEarth 3.0 (c++ code)

Hi, sorry I did not mention the name, I am talking about the osgearth_verticalscale example, it is 7 years old. the class "VerticalScale" does not exist any more.