Changeset 43


Ignore:
Timestamp:
Dec 10, 2004, 10:16:42 AM (20 years ago)
Author:
darran
Message:
  • sky sphere remains at fixed distance from camera
  • back to zero vertical water surface offset
Location:
Swollen
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • Swollen/doc/contract2_hours.txt

    r14 r43  
    222nd Contract Hours
    33------------------
     4
     5
     6
     77 December, Wednesday (4 hours)
     8- new distro released
     9
     10
     11total = 105 hours (2.8 weeks)
     12subtotal = 7 hours
     13
    414
    5152 November, Tuesday (4 hours)
  • Swollen/doc/contract2_priorities.txt

    r36 r43  
    1111- Use per-vertex normals for reflection of light [4]
    1212- Correct scaling and origin for datasets not centered at (0,0)? [3]
    13 - Texture mapped topography [4]
    14 - Culling of triangles [5]         
     13- Texture mapped topography (currently fixed as bedslope.jpg) [4]
     14- Culling of triangles ('c' key to cycle through culling states) [5]
    1515
    1616
     
    2525COMPLETED:
    2626
    27 - Ability to remove light source (it's in the way sometimes) [2]
     27- Ability to remove light source (it's in the way sometimes) (removed totally) [2]
     28- Movement restricted to within bounding sphere (sky now stays at fixed distance
     29  from camera) [1]
     30- z-scaling to emphasize vertical details (via -scale command line parameter) [1]
     31
    2832
    2933
     
    4347- steepcull dataset reveals steep angle cull problem
    4448- dragging sww onto swollen (all in one directory) does not produce the same results as calling from command line
    45 - Problems with Duncan's, Chris' and Stephen Roberts' machines at GA: Swollen won't render semi transparency. Swwiewer works fine.
     49- Problems with Duncan's, Chris' and Stephen Roberts' machines at GA: Swollen won't render semi transparency.
     50  Swwviewer works fine.
    4651
    4752
     
    6772- Scene augmentation with OSG models [2]       
    6873- Optional contour lines of water surface [1]
    69 - z-scaling to emphasize vertical details [1]
    7074- Optional height-dependent semi-transparent water surface [0]
    7175       
     
    7882- Return to home view [2]
    7983- Start up with a view sight from above rather than from the side [2]
    80 - Movement restricted to within bounding sphere [1]
    8184- Command line parameters for culling, speed [1]
    8285- Optional colour coding for momentum [0] (Superseded) 
  • Swollen/swollen/createSky.cpp

    r6 r43  
    44#include <osg/ShapeDrawable>
    55#include <osg/Texture2D>
     6#include <osg/Transform>
    67#include <osg/PolygonOffset>
    78#include <osgDB/Registry>
    89#include <osgDB/ReadFile>
     10#include <osgUtil/CullVisitor>
    911
    1012
    11 osg::Geode* createSky(float radius, char* filename)
     13class MoveHorizonWithEyePointTransform : public osg::Transform
     14{
     15
     16public:
     17
     18    // Get the transformation matrix which moves from local coords to world coords
     19    virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const
     20    {
     21        osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
     22        if (cv)
     23        {
     24            osg::Vec3 eyePointLocal = cv->getEyeLocal();
     25            matrix.preMult(osg::Matrix::translate(eyePointLocal));
     26        }
     27        return true;
     28    }
     29
     30    // Get transformation matrix which moves from world coords to local coords
     31    virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const
     32    {
     33        osgUtil::CullVisitor* cv = dynamic_cast<osgUtil::CullVisitor*>(nv);
     34        if (cv)
     35        {
     36            osg::Vec3 eyePointLocal = cv->getEyeLocal();
     37            matrix.postMult(osg::Matrix::translate(-eyePointLocal));
     38        }
     39        return true;
     40    }
     41};
     42
     43
     44
     45osg::Transform* createSky(float radius, char* filename)
    1246{
    1347    osg::Geode* geode = new osg::Geode;
     
    2458    stateset->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
    2559    geom->setStateSet( stateset );
    26  
     60
    2761    geode->addDrawable(geom);
    28     return geode;
     62
     63    osg::Transform* transform = new MoveHorizonWithEyePointTransform;
     64    transform->setCullingActive(false);
     65    transform->addChild(geode);
     66
     67    return transform;
    2968}
  • Swollen/swollen/main.cpp

    r38 r43  
    2424
    2525// prototypes
    26 osg::Geode* createSky(float radius, char* filename);
     26osg::Transform* createSky(float radius, char* filename);
    2727
    2828
  • Swollen/swollen/watersurface.cpp

    r36 r43  
    2121#define DEF_WATER_COLOUR        0, 0, 0.5, 1        // R, G, B, Alpha (blue)
    2222#define DEF_WATER_TRANSPARENCY  0.1                 // 0=opaque, 1=transparent
    23 #define DEF_ZOFFSET             0.01
     23#define DEF_ZOFFSET             0.00
    2424
    2525// constructor
     
    100100
    101101    // vertical (z) offset to eliminate potential zbuffer problems with bedslope
    102     for( unsigned int iv=0; iv < vertices.get()->size(); iv++ )
    103       vertices.get()->at(iv) += osg::Vec3f( 0.0, 0.0, _zoffset );
     102    //for( unsigned int iv=0; iv < vertices.get()->size(); iv++ )
     103    //  vertices.get()->at(iv) += osg::Vec3f( 0.0, 0.0, _zoffset );
    104104
    105105    _geom->setVertexArray( vertices.get() );
Note: See TracChangeset for help on using the changeset viewer.