Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5323 in orxonox.OLD for trunk/src/lib/graphics


Ignore:
Timestamp:
Oct 8, 2005, 5:27:22 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Shaders can now be loaded via the ResourceManager

Location:
trunk/src/lib/graphics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/shader.cc

    r5322 r5323  
    2323#include "debug.h"
    2424#include "array.h"
     25
     26#include "resource_manager.h"
    2527
    2628
     
    102104}
    103105
     106Shader* Shader::getShader(const char* vertexShaderFile, const char* fragmentShaderFile)
     107{
     108  return (Shader*)ResourceManager::getInstance()->load(vertexShaderFile, SHADER,  RP_LEVEL, (void*)fragmentShaderFile);
     109}
     110
     111bool Shader::unload(Shader* shader)
     112{
     113  return ResourceManager::getInstance()->unload(shader);
     114}
     115
    104116Shader* Shader::storedShader = NULL;
    105117
  • trunk/src/lib/graphics/shader.h

    r5319 r5323  
    2626class Shader : public BaseObject {
    2727
    28  public:
     28  public:
    2929  Shader(const char* vertexShaderFile = NULL, const char* fragmentShaderFile = NULL);
    3030  virtual ~Shader();
     31  static Shader* getShader(const char* vertexShaderFile, const char* fragmentShaderFile);
     32  static bool unload(Shader* shader);
    3133
    3234  bool loadShaderProgramm(SHADER_TYPE type, const char* fileName);
     
    4143
    4244  inline static bool shaderActive() { return (Shader::storedShader != NULL)?true:false; };
     45  inline static Shader* getActiveShader() { return Shader::storedShader; };
    4346  inline static void suspendShader() { Shader* currShader = storedShader; if (storedShader!= NULL) { Shader::deactivateShader(); Shader::storedShader = currShader;} };
    4447  inline static void restoreShader() { if (storedShader != NULL) storedShader->activateShader(); storedShader = NULL; };
Note: See TracChangeset for help on using the changeset viewer.