Issues.00101 - lordmundi/wikidoctest GitHub Wiki
Summary: feature to allow external variable to be mapped to planet2 shaders
Created: 2008–09–09 16:27
Status: Released
Category: Request
From: frankie
Version: 2.0
Released_In: 2.1
Description:
a feature that would allow people to map tcl variables to planet2 shader variables would be useful
This would allow users to adjust colors and levels in the shader on the fly, and also enable and disable sections in the shader, such as the effects of auxillary maps such as clouds.
frankie June 15, 2009, at 11:10 PM: More documentation for this may follow in the future. For now, see the implementation in earthcloud.tcl and to see how we use this capability to turn on and off the cloud layer and the effects of the clouds in multiple shaders in the shaders/ directory.
frankie April 16, 2010, at 04:30 PM: For a more detailed example you can check out the gui/lightning_test.tcl which controls some pseudo-random lightning strikes on the night side of the earth via the cloud shader.
frankie April 25, 2010, at 07:23 AM: Since there are quite a few options to this, here are some examples to show how you might use this capability:
doug.plugin dsp_planet2.parameter [[<planet>.]<layer>.]<parameter> set <list of values>
doug.plugin dsp_planet2.parameter [[<planet>.]<layer>.]<parameter> set.view <viewname> [<list of values>]
doug.plugin dsp_planet2.parameter [[<planet>.]<layer>.]<parameter> set.camera <nodename> [<list of values>]
doug.plugin dsp_planet2.parameter <planet>.<layer>.<parameter> get
doug.plugin dsp_planet2.parameter <planet>.<layer>.<parameter> get.view <viewname>
doug.plugin dsp_planet2.parameter <planet>.<layer>.<parameter> get.camera <nodename>
doug.plugin dsp_planet2.parameter water_col set "0.2 0.2 1.0"
doug.plugin dsp_planet2.parameter EARTH.ground.water_col set.view MAIN "0.2 0.2 1.0"
doug.plugin dsp_planet2.parameter myrot set {1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0}
doug.plugin dsp_planet2.parameter EARTH.do_clouds get
doug.plugin dsp_planet2.parameter do_clouds get
doug.plugin dsp_planet2.parameter EARTH.ground.mytex set.view MAIN "$mytex mag=GL_LINEAR wrap_s=GL_REPEAT"
doug.plugin dsp_planet2.parameter EARTH.ground.mytex set.camera JimboCam "$mytex GL_LINEAR GL_LINEAR GL_REPEAT GL_REPEAT"
doug.plugin dsp_planet2.parameter EARTH.ground.mytex set.view MAIN ""
frankie April 11, 2011, at 04:20 PM: A grep for "parameter" in the shader directory is still probably the best way to see examples of this being used. Someone asked recently about the ability to also tie in a texture to the shader, as demonstrated by the last three example calls above. I realized this wasn't in the current shaders, so here is an example line at the top of a shader that could load in an image that is controllable with the above tcl commands:
parameter sampler2D mytex = {"fun.ppm"};
| commit | 490337b695af2890ccb93e64f0f2c8d92e403496
[link] |
||
| Author: | Frank Graffagnino
|
| Date: | Mon Jun 15 22:58:16 2009 -0500
|
| Message: | [@Issue 00101: Integrated in variable linkage feature
THis integrates in Brad's new feature to dynamically set variables inside the shaders at runtime! Example code is being utilized in the cloud toggle mechanism. The old method has been done away with and we now set a variable in multiple shaders to effectively turn clouds on and off. NOTE: This commit will require the city_lights and cloud_bmp map files to be added to the gisdata dir!!! @] |
Affected Files:
.doug_cshrc | 1 +
configs/planet2.cfg | 58 ++++++++++++++±---------------------
gui/earthcloud.tcl | 4 ±-
plugin_Linux_FC3/dsp_planet2.so | Bin 314507 -> 411847 bytes
shaders/earth_cloud_bmp.fs | 54 ++++++++++++++++++++++±----------
shaders/earth_ground_city_cloud.fs | 6 ++±
6 files changed, 69 insertions(+), 54 deletions(-)