Ignore:
Timestamp:
10/20/08 02:06:33 (16 years ago)
Author:
mattausch
Message:

adding special technique for depth pass (not working yet)

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.cpp

    r3045 r3047  
    1818 
    1919 
    20 void Technique::InitMaterial() 
     20void Technique::Init() 
    2121{ 
    2222        mTexture = NULL; 
     
    2929        mVertexProgram = NULL; 
    3030        mFragmentProgram = NULL; 
     31 
     32        /// if this material can write colors 
     33        mColorWriteEnabled = true; 
     34        /// if lighting is used 
     35        bool mLightingEnabled = true; 
    3136} 
    3237 
     
    3843mEmmisiveColor(RgbaColor(.0f, .0f, .0f, 1.0f)) 
    3944{ 
    40         InitMaterial(); 
     45        Init(); 
    4146} 
    4247 
     
    4853mTexture(NULL) 
    4954{ 
    50         InitMaterial(); 
     55        Init(); 
    5156} 
    5257 
    53  
    54 Technique::Technique(const Technique &tech) 
    55 { 
    56         mAmbientColor = tech.mAmbientColor; 
    57         mDiffuseColor = tech.mDiffuseColor; 
    58         mSpecularColor = tech.mSpecularColor; 
    59         mEmmisiveColor = tech.mEmmisiveColor; 
    60  
    61         mVertexProgram = tech.mVertexProgram; 
    62         mFragmentProgram = tech.mFragmentProgram; 
    63  
    64         mAlphaTestEnabled = tech.mAlphaTestEnabled; 
    65         mCullFaceEnabled =tech.mCullFaceEnabled; 
    66  
    67         mTexture = tech.mTexture; 
    68  
    69         mVertexProgramParameters = tech.mVertexProgramParameters; 
    70         mFragmentProgramParameters = tech.mFragmentProgramParameters; 
    71 } 
    7258 
    7359 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.h

    r3045 r3047  
    5555        Technique(); 
    5656 
    57         Technique(const Technique &tech); 
    58  
    5957        ~Technique(); 
    6058        /** Sets ambient and diffuse color to color 
    6159        */ 
    6260        Technique(const RgbaColor &color); 
     61        /** Renders this technique. 
     62        */ 
     63        void Render(RenderState *state); 
     64        /** Initialize this technique material with default values 
     65        */ 
     66        void Init(); 
    6367 
    6468        inline Texture *GetTexture() const { return mTexture; } 
     
    8185        inline bool IsAlphaTestEnabled() const { return mAlphaTestEnabled; }  
    8286        inline bool IsCullFaceEnabled() const { return mCullFaceEnabled; }  
    83         /** Renders this technique. 
    84         */ 
    85         void Render(RenderState *state); 
    86         /** Initialize the material with default values 
    87         */ 
    88         void InitMaterial(); 
     87 
     88        inline void SetLightingEnabled(bool l) { mLightingEnabled = l; } 
     89        inline void SetColorWriteEnabled(bool c) { mColorWriteEnabled = c; } 
     90 
     91        inline bool IsLightingEnabled() const { return mLightingEnabled; }  
     92        inline bool IsColorWriteEnabled() const { return mColorWriteEnabled; }  
    8993 
    9094        void SetFragmentProgram(ShaderProgram *p); 
     
    9498        ShaderProgram *GetVertexProgram() { return mVertexProgram; } 
    9599 
    96         //void SetFragmentProgramParameters(const GPUProgramParameters &p) { mGPUFragmentParameters = p; } 
    97         //void SetVertexProgramParameters(const GPUProgramParameters &p) { mGPUVertexParameters = p; } 
    98  
    99         /** Each technique has a distict set of parameters. 
     100        /** Get the set of fragment parameters of this technique 
    100101        */ 
    101102        GPUProgramParameters * const GetFragmentProgramParameters() { return &mFragmentProgramParameters; } 
     103        /**  Get the set of vertex parameters of this technique 
     104        */ 
    102105        GPUProgramParameters * const GetVertexProgramParameters() { return &mVertexProgramParameters; } 
    103106 
     
    122125        ShaderProgram *mFragmentProgram; 
    123126        ShaderProgram *mVertexProgram; 
     127        /// if this material can write colors 
     128        bool mColorWriteEnabled; 
     129        /// if lighting is used 
     130        bool mLightingEnabled; 
    124131}; 
    125132 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.cpp

    r3043 r3047  
    199199        } 
    200200 
    201         ////////// 
     201        /////////////////// 
    202202        //-- fragment and vertex programs 
    203203         
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderState.h

    r3043 r3047  
    9898        bool mFragmentProgramEnabled; 
    9999        bool mVertexProgramEnabled; 
     100 
     101        bool mUseLighting; 
     102        bool mColorWriteEnabled; 
    100103}; 
    101104 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp

    r3046 r3047  
    156156 
    157157        /////////// 
    158         //-- hack: add tree animation 
     158        //-- hack: add tree animation (should be done per material script!) 
    159159 
    160160        if (numLODs > 1) 
    161161        { 
    162                 //for (int i = 0; i < min(numLODs, 2); ++ i) 
    163                 for (int i = 0; i < numLODs; ++ i) 
     162                ShapeContainer::iterator sstart, send; 
     163 
     164                // only use shader for the first two lod levels (the non-billboards) 
     165                for (int i = 0; i < min(numLODs, 2); ++ i) 
     166                //for (int i = 0; i < numLODs; ++ i) 
    164167                { 
    165                         ShapeContainer::iterator sstart, send; 
    166168                        sceneGeom->GetLODLevel(i, sstart, send); 
    167169 
Note: See TracChangeset for help on using the changeset viewer.