Changeset 3147


Ignore:
Timestamp:
11/20/08 12:56:59 (16 years ago)
Author:
mattausch
Message:

updated shader loading

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

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Camera.h

    r3102 r3147  
    2222public: 
    2323 
     24        enum {LEFT_PLANE, RIGHT_PLANE, BOTTOM_PLANE, TOP_PLANE, NEAR_PLANE, FAR_PLANE}; 
     25 
    2426        Frustum() {}; 
    2527 
    2628        Frustum(const Matrix4x4 &trafo); 
    27  
    28         enum { LEFT_PLANE, RIGHT_PLANE, BOTTOM_PLANE, TOP_PLANE, NEAR_PLANE, FAR_PLANE}; 
    2929 
    3030        /** Resizes the current frustum so that it fully encloses the given polyhedron 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h

    r3117 r3147  
    1515public: 
    1616 
    17         enum FORMAT { RGB_UBYTE, RGBA_UBYTE, RGB_FLOAT_16, RGBA_FLOAT_16, RGB_FLOAT_32, RGBA_FLOAT_32 }; 
    18  
    19         enum WRAP_TYPE { WRAP_REPEAT, WRAP_CLAMP_TO_EDGE }; 
    20         enum FILTER_TYPE { FILTER_NEAREST, FILTER_LINEAR }; 
     17        enum FORMAT {RGB_UBYTE, RGBA_UBYTE, RGB_FLOAT_16, RGBA_FLOAT_16, RGB_FLOAT_32, RGBA_FLOAT_32}; 
     18        enum WRAP_TYPE {WRAP_REPEAT, WRAP_CLAMP_TO_EDGE}; 
     19        enum FILTER_TYPE {FILTER_NEAREST, FILTER_LINEAR}; 
    2120 
    2221 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Material.cpp

    r3114 r3147  
    7474void Technique::SetFragmentProgram(ShaderProgram *p)  
    7575{  
     76        if (p->GetProgramType() == ShaderProgram::VERTEX_PROGRAM) 
     77                cerr << "warning: assigning a vertex program as fragment program!" << endl; 
     78 
    7679        mFragmentProgram = p; 
    7780        mFragmentProgramParameters.Reset(); 
     
    8285void Technique::SetVertexProgram(ShaderProgram *p)  
    8386{  
    84         mVertexProgram = p;  
     87        if (p->GetProgramType() == ShaderProgram::FRAGMENT_PROGRAM) 
     88                cerr << "warning: assigning a fragment program as vertex program!" << endl; 
     89 
     90        mVertexProgram = p; 
    8591        mVertexProgramParameters.Reset(); 
    8692        mVertexProgramParameters.SetProgram(p); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/RenderTraverser.h

    r3102 r3147  
    5252public: 
    5353 
     54        /// types of traversers 
     55        enum {CULL_FRUSTUM, STOP_AND_WAIT, CHC, CHCPLUSPLUS, NUM_TRAVERSAL_TYPES}; 
     56 
    5457        /** Default constructor. 
    5558        */ 
     
    6265        void RenderScene(); 
    6366 
    64         enum {CULL_FRUSTUM, STOP_AND_WAIT, CHC, CHCPLUSPLUS, NUM_TRAVERSAL_TYPES}; 
    6567        /** Returns the type of the traversal. 
    6668            The type is one of 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderManager.cpp

    r3146 r3147  
    207207        const string fullName = "src/shaders/" + filename + ".cg"; 
    208208         
    209         ShaderProgram *p =  
    210                 new ShaderProgram(sCgContext, fullName,  
    211                                   isFragment ? sCgFragmentProfile : sCgVertexProfile, funcName); 
     209        ShaderProgram *p; 
     210 
     211        if (isFragment) 
     212        { 
     213                p = new ShaderProgram(sCgContext, fullName, sCgFragmentProfile, funcName, ShaderProgram::FRAGMENT_PROGRAM); 
     214        } 
     215        else 
     216        { 
     217                p = new ShaderProgram(sCgContext, fullName, sCgVertexProfile, funcName, ShaderProgram::VERTEX_PROGRAM); 
     218        } 
    212219 
    213220        if (GetShaderProgram(name)) 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderProgram.cpp

    r3116 r3147  
    360360                                                         const std::string &filename,  
    361361                                                         CGprofile profile, 
    362                                                          const std::string &functionName) 
     362                                                         const std::string &functionName, 
     363                                                         PROGRAM_TYPE programType): 
     364mProgramType(programType) 
    363365{ 
    364366        mProgram = cgCreateProgramFromFile(context,  
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderProgram.h

    r3115 r3147  
    220220public: 
    221221 
     222        enum PROGRAM_TYPE {FRAGMENT_PROGRAM, VERTEX_PROGRAM}; 
     223 
     224 
    222225        ShaderProgram(CGprogram program): mProgram(program) {} 
    223226 
     
    225228                          const std::string &filename,  
    226229                                  CGprofile profile, 
    227                                   const std::string &functionName); 
     230                                  const std::string &functionName, 
     231                                  PROGRAM_TYPE type); 
    228232 
    229233        ~ShaderProgram() { if (mProgram != NULL) cgDestroyProgram(mProgram); } 
     
    276280        */ 
    277281        void Bind(); 
     282        /** Releases all texture resources. 
     283        */ 
     284        void Release(); 
     285 
    278286        /** Returns true if this program is valid. 
    279287        */ 
    280         inline bool IsValid() const { return mProgram != NULL; } 
    281         /** Releases all texture resources. 
    282         */ 
    283         void Release(); 
     288        inline bool IsValid() const {return mProgram != NULL;} 
     289         
     290 
     291        /** Returns type of program (fragment program or vertex program} 
     292        */ 
     293        inline PROGRAM_TYPE GetProgramType() const {return mProgramType;} 
     294        /** See get 
     295        */ 
     296        inline void SetProgramType(PROGRAM_TYPE type) {mProgramType = type;} 
    284297 
    285298 
     
    301314        CGParameterArray mTextureParams; 
    302315        CGParameterArray mParameters; 
     316 
     317        PROGRAM_TYPE mProgramType; 
    303318}; 
    304319 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Texture.h

    r2964 r3147  
    1515{ 
    1616public: 
     17         
     18        enum {FORMAT_INVALID, FORMAT_RGB, FORMAT_RGBA}; 
     19         
     20        enum {CLAMP, REPEAT}; 
     21 
     22 
    1723        /** Constructor loading texture from file 
    1824        */ 
     
    2430        */ 
    2531        void *GetImage() const; 
    26          
    27         enum { FORMAT_INVALID, FORMAT_RGB, FORMAT_RGBA }; 
    28          
    29         enum { CLAMP, REPEAT }; 
    30  
    3132        /** Returns width of texture. 
    3233        */ 
     
    4142        */ 
    4243        std::string GetName() const; 
    43  
     44        /** Returns byte size of a row of the image. 
     45        */ 
    4446        int GetRowLength() const; 
    45  
     47        /** Returns byte size of one pixel 
     48        */ 
    4649        int GetPixelSize() const; 
    47          
     50        /** Returns byte size of the image 
     51        */ 
    4852        inline int GetByteSize() const; 
    4953        /** Bind the texture. 
    5054        */ 
    5155        void Bind() const; 
    52  
     56        /** Sets the boundary mode for the s texture coordinate parameter. 
     57        */ 
    5358        void SetBoundaryModeS(int mode) { mBoundaryModeS = mode; } 
     59        /** Sets the boundary mode for the T texture coordinate parameter. 
     60        */ 
    5461        void SetBoundaryModeT(int mode) { mBoundaryModeT = mode; } 
    55  
    56         //void SetUseMipMap(bool useMipMap) { mUseMipMap = useMipMap; } 
    5762 
    5863        int GetBoundaryModeS() const { return mBoundaryModeS; } 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg

    r3146 r3147  
    9898        //float4 col = float4(centerNormal * 0.5f + float3(0.5f), 0); 
    9999        //float4 col = float4(centerNormal, 0); 
     100 
    100101        // push through the current depth 
    101102        col.w = centerDepth.x; 
Note: See TracChangeset for help on using the changeset viewer.