Renamed a bunch of shader related classes in NL3D to contain the word Usr, since they are user shader related.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
parent 6c58856ed7
commit c6bb6ec2a9

@ -22,20 +22,20 @@
namespace NL3D
{
class CShaderManager;
class CUsrShaderManager;
class CShaderLoader
class CUsrShaderLoader
{
public:
CShaderLoader();
~CShaderLoader();
void setManager( CShaderManager *mgr ){ manager = mgr; }
CUsrShaderLoader();
~CUsrShaderLoader();
void setManager( CUsrShaderManager *mgr ){ manager = mgr; }
void loadShaders( const std::string &directory );
private:
void loadShader( const std::string &file );
CShaderManager *manager;
CUsrShaderManager *manager;
};
}

@ -15,8 +15,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SHADER_MANAGER_H
#define SHADER_MANAGER_H
#ifndef USR_SHADER_MANAGER_H
#define USR_SHADER_MANAGER_H
#include <map>
#include <vector>
@ -24,25 +24,25 @@
namespace NL3D
{
class CShaderProgram;
class IShaderVisitor;
class CUsrShaderProgram;
class IUsrShaderVisitor;
class CShaderManager
class CUsrShaderManager
{
public:
CShaderManager();
~CShaderManager();
CUsrShaderManager();
~CUsrShaderManager();
void clear();
void getShaderList( std::vector< std::string > &v );
bool addShader( CShaderProgram *program );
bool addShader( CUsrShaderProgram *program );
bool removeShader( const std::string &name );
bool changeShader( const std::string &name, CShaderProgram *program );
bool getShader( const std::string &name, CShaderProgram *program );
void visitShaders( IShaderVisitor *visitor );
void visitShader( const std::string &name, IShaderVisitor *visitor );
bool changeShader( const std::string &name, CUsrShaderProgram *program );
bool getShader( const std::string &name, CUsrShaderProgram *program );
void visitShaders( IUsrShaderVisitor *visitor );
void visitShader( const std::string &name, IUsrShaderVisitor *visitor );
private:
std::map< std::string, CShaderProgram* > programs;
std::map< std::string, CUsrShaderProgram* > programs;
};
}

@ -23,14 +23,14 @@
namespace NL3D
{
class CShaderProgram : public NLMISC::IStreamable
class CUsrShaderProgram : public NLMISC::IStreamable
{
public:
CShaderProgram();
CUsrShaderProgram();
~CShaderProgram();
~CUsrShaderProgram();
std::string getClassName(){ return "CShaderProgram"; }
std::string getClassName(){ return "CUsrShaderProgram"; }
void serial( NLMISC::IStream &f );

@ -15,32 +15,32 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SHADER_SAVER_H
#define SHADER_SAVER_H
#ifndef USR_SHADER_SAVER_H
#define USR_SHADER_SAVER_H
#include "nel/3d/shader_visitor.h"
#include "nel/3d/usr_shader_visitor.h"
#include <string>
namespace NL3D
{
class CShaderProgram;
class CShaderManager;
class CUsrShaderProgram;
class CUsrShaderManager;
class CShaderSaver : public IShaderVisitor
class CUsrShaderSaver : public IUsrShaderVisitor
{
public:
CShaderSaver();
~CShaderSaver();
CUsrShaderSaver();
~CUsrShaderSaver();
void setManager( CShaderManager *mgr ){ manager = mgr; }
void setManager( CUsrShaderManager *mgr ){ manager = mgr; }
void visit( CShaderProgram *program );
void visit( CUsrShaderProgram *program );
void saveShaders( const std::string &directory );
void saveShader( const std::string &directory, const std::string &name );
private:
CShaderManager *manager;
CUsrShaderManager *manager;
std::string outputDir;
};
}

@ -15,20 +15,20 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SHADER_VISITOR_H
#define SHADER_VISITOR_H
#ifndef USR_SHADER_VISITOR_H
#define USR_SHADER_VISITOR_H
namespace NL3D
{
class CShaderProgram;
class CUsrShaderProgram;
class IShaderVisitor
class IUsrShaderVisitor
{
public:
IShaderVisitor(){}
~IShaderVisitor(){}
IUsrShaderVisitor(){}
~IUsrShaderVisitor(){}
virtual void visit( CShaderProgram *program ) = 0;
virtual void visit( CUsrShaderProgram *program ) = 0;
};

@ -15,25 +15,25 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nel/3d/shader_loader.h"
#include "nel/3d/shader_manager.h"
#include "nel/3d/shader_program.h"
#include "nel/3d/usr_shader_loader.h"
#include "nel/3d/usr_shader_manager.h"
#include "nel/3d/usr_shader_program.h"
#include "nel/misc/file.h"
#include "nel/misc/path.h"
#include "nel/misc/i_xml.h"
namespace NL3D
{
CShaderLoader::CShaderLoader()
CUsrShaderLoader::CUsrShaderLoader()
{
manager = NULL;
}
CShaderLoader::~CShaderLoader()
CUsrShaderLoader::~CUsrShaderLoader()
{
}
void CShaderLoader::loadShaders( const std::string &directory )
void CUsrShaderLoader::loadShaders( const std::string &directory )
{
if( manager == NULL )
return;
@ -54,7 +54,7 @@ namespace NL3D
}
}
void CShaderLoader::loadShader( const std::string &file )
void CUsrShaderLoader::loadShader( const std::string &file )
{
NLMISC::CIFile f;
if( !f.open( file, true ) )
@ -64,7 +64,7 @@ namespace NL3D
if( !xml.init( f ) )
return;
CShaderProgram *p = new CShaderProgram();
CUsrShaderProgram *p = new CUsrShaderProgram();
p->serial( xml );
manager->addShader( p );

@ -15,25 +15,25 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nel/3d/shader_manager.h"
#include "nel/3d/shader_program.h"
#include "nel/3d/shader_visitor.h"
#include "nel/3d/usr_shader_manager.h"
#include "nel/3d/usr_shader_program.h"
#include "nel/3d/usr_shader_visitor.h"
namespace NL3D
{
CShaderManager::CShaderManager()
CUsrShaderManager::CUsrShaderManager()
{
}
CShaderManager::~CShaderManager()
CUsrShaderManager::~CUsrShaderManager()
{
clear();
}
void CShaderManager::clear()
void CUsrShaderManager::clear()
{
std::map< std::string, CShaderProgram* >::iterator itr = programs.begin();
std::map< std::string, CUsrShaderProgram* >::iterator itr = programs.begin();
while( itr != programs.end() )
{
delete itr->second;
@ -42,12 +42,12 @@ namespace NL3D
programs.clear();
}
void CShaderManager::getShaderList( std::vector< std::string > &v )
void CUsrShaderManager::getShaderList( std::vector< std::string > &v )
{
v.clear();
std::string n;
std::map< std::string, CShaderProgram* >::iterator itr = programs.begin();
std::map< std::string, CUsrShaderProgram* >::iterator itr = programs.begin();
while( itr != programs.end() )
{
itr->second->getName( n );
@ -56,12 +56,12 @@ namespace NL3D
}
}
bool CShaderManager::addShader( CShaderProgram *program )
bool CUsrShaderManager::addShader( CUsrShaderProgram *program )
{
std::string n;
program->getName( n );
std::map< std::string, CShaderProgram* >::iterator itr
std::map< std::string, CUsrShaderProgram* >::iterator itr
= programs.find( n );
if( itr != programs.end() )
return false;
@ -70,9 +70,9 @@ namespace NL3D
return true;
}
bool CShaderManager::removeShader( const std::string &name )
bool CUsrShaderManager::removeShader( const std::string &name )
{
std::map< std::string, CShaderProgram* >::iterator itr
std::map< std::string, CUsrShaderProgram* >::iterator itr
= programs.find( name );
if( itr == programs.end() )
return false;
@ -84,14 +84,14 @@ namespace NL3D
return true;
}
bool CShaderManager::changeShader( const std::string &name, CShaderProgram *program )
bool CUsrShaderManager::changeShader( const std::string &name, CUsrShaderProgram *program )
{
std::map< std::string, CShaderProgram* >::iterator itr
std::map< std::string, CUsrShaderProgram* >::iterator itr
= programs.find( name );
if( itr == programs.end() )
return false;
CShaderProgram *p = itr->second;
CUsrShaderProgram *p = itr->second;
std::string s;
program->getName( s );
@ -109,14 +109,14 @@ namespace NL3D
return true;
}
bool CShaderManager::getShader( const std::string &name, CShaderProgram *program )
bool CUsrShaderManager::getShader( const std::string &name, CUsrShaderProgram *program )
{
std::map< std::string, CShaderProgram* >::iterator itr
std::map< std::string, CUsrShaderProgram* >::iterator itr
= programs.find( name );
if( itr == programs.end() )
return false;
CShaderProgram *p = itr->second;
CUsrShaderProgram *p = itr->second;
std::string s;
program->setName( name );
@ -133,9 +133,9 @@ namespace NL3D
return true;
}
void CShaderManager::visitShaders( IShaderVisitor *visitor )
void CUsrShaderManager::visitShaders( IUsrShaderVisitor *visitor )
{
std::map< std::string, CShaderProgram* >::iterator itr = programs.begin();
std::map< std::string, CUsrShaderProgram* >::iterator itr = programs.begin();
while( itr != programs.end() )
{
visitor->visit( itr->second );
@ -143,9 +143,9 @@ namespace NL3D
}
}
void CShaderManager::visitShader( const std::string &name, IShaderVisitor *visitor )
void CUsrShaderManager::visitShader( const std::string &name, IUsrShaderVisitor *visitor )
{
std::map< std::string, CShaderProgram* >::iterator itr =
std::map< std::string, CUsrShaderProgram* >::iterator itr =
programs.find( name );
if( itr == programs.end() )
return;

@ -15,22 +15,22 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nel/3d/shader_program.h"
#include "nel/3d/usr_shader_program.h"
namespace NL3D
{
CShaderProgram::CShaderProgram()
CUsrShaderProgram::CUsrShaderProgram()
{
vpId = 0;
fpId = 0;
pId = 0;
}
CShaderProgram::~CShaderProgram()
CUsrShaderProgram::~CUsrShaderProgram()
{
}
void CShaderProgram::serial( NLMISC::IStream &f )
void CUsrShaderProgram::serial( NLMISC::IStream &f )
{
f.xmlPush( "ShaderProgram" );

@ -15,24 +15,24 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nel/3d/shader_saver.h"
#include "nel/3d/shader_manager.h"
#include "nel/3d/shader_program.h"
#include "nel/3d/usr_shader_saver.h"
#include "nel/3d/usr_shader_manager.h"
#include "nel/3d/usr_shader_program.h"
#include "nel/misc/file.h"
#include "nel/misc/o_xml.h"
namespace NL3D
{
CShaderSaver::CShaderSaver()
CUsrShaderSaver::CUsrShaderSaver()
{
manager = NULL;
}
CShaderSaver::~CShaderSaver()
CUsrShaderSaver::~CUsrShaderSaver()
{
}
void CShaderSaver::visit( CShaderProgram *program )
void CUsrShaderSaver::visit( CUsrShaderProgram *program )
{
std::string fn;
program->getName( fn );
@ -55,13 +55,13 @@ namespace NL3D
}
void CShaderSaver::saveShaders( const std::string &directory )
void CUsrShaderSaver::saveShaders( const std::string &directory )
{
outputDir = directory;
manager->visitShaders( this );
}
void CShaderSaver::saveShader( const std::string &directory, const std::string &name )
void CUsrShaderSaver::saveShader( const std::string &directory, const std::string &name )
{
outputDir = directory;
manager->visitShader( name, this );

@ -16,10 +16,10 @@
#include "nel3d_interface.h"
#include "nel/3d/dynamic_material.h"
#include "nel/3d/shader_manager.h"
#include "nel/3d/shader_program.h"
#include "nel/3d/shader_loader.h"
#include "nel/3d/shader_saver.h"
#include "nel/3d/usr_shader_manager.h"
#include "nel/3d/usr_shader_program.h"
#include "nel/3d/usr_shader_loader.h"
#include "nel/3d/usr_shader_saver.h"
#include "nel/3d/driver_user.h"
#include "nel/3d/scene_user.h"
#include "nel/3d/u_camera.h"
@ -231,7 +231,7 @@ namespace MaterialEditor
CNel3DInterface::CNel3DInterface()
{
shaderManager = new NL3D::CShaderManager();
shaderManager = new NL3D::CUsrShaderManager();
driver = NULL;
scene = NULL;
mouseListener = NULL;
@ -324,7 +324,7 @@ namespace MaterialEditor
bool CNel3DInterface::getShaderInfo( const std::string &name, SShaderInfo &info )
{
NL3D::CShaderProgram program;
NL3D::CUsrShaderProgram program;
bool ok = shaderManager->getShader( name, &program );
if( !ok )
return false;
@ -346,7 +346,7 @@ namespace MaterialEditor
bool CNel3DInterface::updateShaderInfo( const SShaderInfo &info )
{
NL3D::CShaderProgram program;
NL3D::CUsrShaderProgram program;
program.setName( info.name );
program.setDescription( info.description );
program.setVP( info.vp );
@ -357,7 +357,7 @@ namespace MaterialEditor
bool CNel3DInterface::addShader( const SShaderInfo &info )
{
NL3D::CShaderProgram *program = new NL3D::CShaderProgram();
NL3D::CUsrShaderProgram *program = new NL3D::CUsrShaderProgram();
program->setName( info.name );
program->setDescription( info.description );
@ -381,14 +381,14 @@ namespace MaterialEditor
void CNel3DInterface::loadShaders()
{
NL3D::CShaderLoader loader;
NL3D::CUsrShaderLoader loader;
loader.setManager( shaderManager );
loader.loadShaders( "./shaders" );
}
void CNel3DInterface::saveShader( const std::string &name )
{
NL3D::CShaderSaver saver;
NL3D::CUsrShaderSaver saver;
saver.setManager( shaderManager );
saver.saveShader( "./shaders", name );
}

@ -25,7 +25,7 @@ namespace NL3D
{
class CDynMaterial;
struct SRenderPass;
class CShaderManager;
class CUsrShaderManager;
class UDriver;
class UScene;
class U3dMouseListener;
@ -174,7 +174,7 @@ namespace MaterialEditor
unsigned long subMatId;
NL3D::CShaderManager *shaderManager;
NL3D::CUsrShaderManager *shaderManager;
NL3D::UDriver *driver;
NL3D::UScene *scene;
NL3D::U3dMouseListener *mouseListener;

Loading…
Cancel
Save