* make EmptyRadius::HasRadius returns false
* make gl/Shader and gl/Program* a bit easier to use: - automatic object creation - add Uniform() overloads for vcg::Point*f types
This commit is contained in:
parent
79ef95435a
commit
64ce68dac0
|
|
@ -8,7 +8,7 @@
|
||||||
* \ *
|
* \ *
|
||||||
* All rights reserved. *
|
* All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
|
|
@ -129,7 +129,7 @@ All the Components that can be added to a vertex should be defined in the namesp
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*------------------------- EMPTY COORD & NORMAL -----------------------------------------*/
|
/*------------------------- EMPTY COORD & NORMAL -----------------------------------------*/
|
||||||
template <class T> class EmptyCoordNormal: public T {
|
template <class T> class EmptyCoordNormal: public T {
|
||||||
public:
|
public:
|
||||||
typedef vcg::Point3f CoordType;
|
typedef vcg::Point3f CoordType;
|
||||||
|
|
@ -147,11 +147,11 @@ public:
|
||||||
static bool HasNormal() { return false; }
|
static bool HasNormal() { return false; }
|
||||||
static bool HasNormalOcc() { return false; }
|
static bool HasNormalOcc() { return false; }
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
|
||||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- COORD ----------------------------------------*/
|
/*-------------------------- COORD ----------------------------------------*/
|
||||||
|
|
||||||
template <class A, class T> class Coord: public T {
|
template <class A, class T> class Coord: public T {
|
||||||
public:
|
public:
|
||||||
|
|
@ -163,12 +163,12 @@ public:
|
||||||
CoordType &UberP() { return _coord; }
|
CoordType &UberP() { return _coord; }
|
||||||
|
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { P().Import(left.cP()); T::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { P().Import(left.cP()); T::ImportLocal( left); }
|
||||||
static bool HasCoord() { return true; }
|
static bool HasCoord() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CoordType _coord;
|
CoordType _coord;
|
||||||
};
|
};
|
||||||
template <class T> class Coord3f: public Coord<vcg::Point3f, T> {
|
template <class T> class Coord3f: public Coord<vcg::Point3f, T> {
|
||||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3f"));T::Name(name);}
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3f"));T::Name(name);}
|
||||||
|
|
@ -177,7 +177,7 @@ template <class T> class Coord3d: public Coord<vcg::Point3d, T> {
|
||||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3d"));T::Name(name);}
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3d"));T::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- NORMAL ----------------------------------------*/
|
/*-------------------------- NORMAL ----------------------------------------*/
|
||||||
|
|
||||||
template <class A, class T> class Normal: public T {
|
template <class A, class T> class Normal: public T {
|
||||||
public:
|
public:
|
||||||
|
|
@ -190,7 +190,7 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NormalType _norm;
|
NormalType _norm;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T> class Normal3s: public Normal<vcg::Point3s, T> {
|
template <class T> class Normal3s: public Normal<vcg::Point3s, T> {
|
||||||
|
|
@ -204,7 +204,7 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/
|
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/
|
||||||
|
|
||||||
template <class T> class EmptyMark: public T {
|
template <class T> class EmptyMark: public T {
|
||||||
public:
|
public:
|
||||||
|
|
@ -228,12 +228,12 @@ public:
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { IMark() = left.IMark(); T::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { IMark() = left.IMark(); T::ImportLocal( left); }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _imark;
|
int _imark;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- TEXCOORD ----------------------------------------*/
|
/*-------------------------- TEXCOORD ----------------------------------------*/
|
||||||
|
|
||||||
template <class TT> class EmptyTexCoord: public TT {
|
template <class TT> class EmptyTexCoord: public TT {
|
||||||
public:
|
public:
|
||||||
|
|
@ -256,7 +256,7 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TexCoordType _t;
|
TexCoordType _t;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class TT> class TexCoord2s: public TexCoord<TexCoord2<short,1>, TT> {
|
template <class TT> class TexCoord2s: public TexCoord<TexCoord2<short,1>, TT> {
|
||||||
|
|
@ -270,7 +270,7 @@ template <class TT> class TexCoord2d: public TexCoord<TexCoord2<double,1>, TT> {
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord2d"));TT::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord2d"));TT::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*------------------------- FLAGS -----------------------------------------*/
|
/*------------------------- FLAGS -----------------------------------------*/
|
||||||
template <class T> class EmptyBitFlags: public T {
|
template <class T> class EmptyBitFlags: public T {
|
||||||
public:
|
public:
|
||||||
typedef int FlagType;
|
typedef int FlagType;
|
||||||
|
|
@ -296,10 +296,10 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _flags;
|
int _flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- EMPTY COLOR & QUALITY ----------------------------------*/
|
/*-------------------------- EMPTY COLOR & QUALITY ----------------------------------*/
|
||||||
|
|
||||||
template <class T> class EmptyColorQuality: public T {
|
template <class T> class EmptyColorQuality: public T {
|
||||||
public:
|
public:
|
||||||
|
|
@ -315,7 +315,7 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
static void Name(std::vector<std::string> & name){T::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- Color ----------------------------------*/
|
/*-------------------------- Color ----------------------------------*/
|
||||||
|
|
||||||
template <class A, class T> class Color: public T {
|
template <class A, class T> class Color: public T {
|
||||||
public:
|
public:
|
||||||
|
|
@ -330,14 +330,14 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ColorType _color;
|
ColorType _color;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class TT> class Color4b: public Color<vcg::Color4b, TT> {
|
template <class TT> class Color4b: public Color<vcg::Color4b, TT> {
|
||||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));TT::Name(name);}
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));TT::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- Quality ----------------------------------*/
|
/*-------------------------- Quality ----------------------------------*/
|
||||||
|
|
||||||
template <class A, class TT> class Quality: public TT {
|
template <class A, class TT> class Quality: public TT {
|
||||||
public:
|
public:
|
||||||
|
|
@ -350,7 +350,7 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QualityType _quality;
|
QualityType _quality;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class TT> class Qualitys: public Quality<short, TT> {
|
template <class TT> class Qualitys: public Quality<short, TT> {
|
||||||
|
|
@ -392,7 +392,7 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){TT::Name(name);}
|
static void Name(std::vector<std::string> & name){TT::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- Curvature ----------------------------------*/
|
/*-------------------------- Curvature ----------------------------------*/
|
||||||
|
|
||||||
template <class TT> class EmptyCurvature: public TT {
|
template <class TT> class EmptyCurvature: public TT {
|
||||||
public:
|
public:
|
||||||
|
|
@ -422,7 +422,7 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvature"));TT::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvature"));TT::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Point2<A> _hk;
|
Point2<A> _hk;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -433,14 +433,14 @@ template <class T> class Curvatured: public Curvature<double , T> {
|
||||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvatured"));T::Name(name);}
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvatured"));T::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- Curvature Direction ----------------------------------*/
|
/*-------------------------- Curvature Direction ----------------------------------*/
|
||||||
|
|
||||||
template <class S>
|
template <class S>
|
||||||
struct CurvatureDirBaseType{
|
struct CurvatureDirBaseType{
|
||||||
typedef Point3<S> VecType;
|
typedef Point3<S> VecType;
|
||||||
typedef S ScalarType;
|
typedef S ScalarType;
|
||||||
CurvatureDirBaseType () {}
|
CurvatureDirBaseType () {}
|
||||||
Point3<S>max_dir,min_dir; // max and min curvature direction
|
Point3<S>max_dir,min_dir; // max and min curvature direction
|
||||||
S k1,k2;// max and min curvature values
|
S k1,k2;// max and min curvature values
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -482,7 +482,7 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CurvatureDirType _curv;
|
CurvatureDirType _curv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -493,25 +493,25 @@ template <class T> class CurvatureDird: public CurvatureDir<CurvatureDirBaseType
|
||||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDird"));T::Name(name);}
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDird"));T::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- Empty Radius ----------------------------------*/
|
/*-------------------------- Empty Radius ----------------------------------*/
|
||||||
|
|
||||||
template <class T> class EmptyRadius: public T {
|
template <class T> class EmptyRadius: public T {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef float RadiusType;
|
typedef float RadiusType;
|
||||||
typedef RadiusType ScalarType;
|
typedef RadiusType ScalarType;
|
||||||
|
|
||||||
RadiusType &R(){ static ScalarType v = 0.0; assert(0); return v; }
|
RadiusType &R(){ static ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; }
|
||||||
const RadiusType &cR() const { static const ScalarType & v = 0.0; assert(0); return v; }
|
const RadiusType &cR() const { static const ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; }
|
||||||
|
|
||||||
static bool HasRadius() { return true; }
|
static bool HasRadius() { return false; }
|
||||||
static bool HasRadiusOcf() { return true; }
|
static bool HasRadiusOcf() { return false; }
|
||||||
static void Name(std::vector<std::string> & name){ T::Name(name);}
|
static void Name(std::vector<std::string> & name){ T::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------- VEADJ ------------------------------*/
|
/*----------------------------- VEADJ ------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
template <class T> class EmptyVEAdj: public T {
|
template <class T> class EmptyVEAdj: public T {
|
||||||
|
|
@ -537,13 +537,13 @@ public:
|
||||||
static bool HasVEAdjacency() { return true; }
|
static bool HasVEAdjacency() { return true; }
|
||||||
static bool HasVEAdjacencyOcc() { return true; }
|
static bool HasVEAdjacencyOcc() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("VEAdj"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("VEAdj"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typename T::EdgePointer _ep ;
|
typename T::EdgePointer _ep ;
|
||||||
int _zp ;
|
int _zp ;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*----------------------------- VFADJ ------------------------------*/
|
/*----------------------------- VFADJ ------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
template <class T> class EmptyVFAdj: public T {
|
template <class T> class EmptyVFAdj: public T {
|
||||||
|
|
@ -571,11 +571,11 @@ public:
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typename T::FacePointer _fp ;
|
typename T::FacePointer _fp ;
|
||||||
int _zp ;
|
int _zp ;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*----------------------------- VTADJ ------------------------------*/
|
/*----------------------------- VTADJ ------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
template <class T> class EmptyVTAdj: public T {
|
template <class T> class EmptyVTAdj: public T {
|
||||||
|
|
@ -599,8 +599,8 @@ public:
|
||||||
static void Name( std::vector< std::string > & name ) { name.push_back( std::string("VTAdj") ); T::Name(name); }
|
static void Name( std::vector< std::string > & name ) { name.push_back( std::string("VTAdj") ); T::Name(name); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typename T::TetraPointer _tp ;
|
typename T::TetraPointer _tp ;
|
||||||
int _zp ;
|
int _zp ;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace vert
|
} // end namespace vert
|
||||||
|
|
|
||||||
|
|
@ -557,7 +557,7 @@ public:
|
||||||
typedef A RadiusType;
|
typedef A RadiusType;
|
||||||
typedef RadiusType ScalarType;
|
typedef RadiusType ScalarType;
|
||||||
|
|
||||||
RadiusType &R(){ assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
|
RadiusType &R(){ assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
|
||||||
const RadiusType &cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
|
const RadiusType &cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
|
||||||
|
|
||||||
template <class LeftV>
|
template <class LeftV>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#include "gl_object.h"
|
#include "gl_object.h"
|
||||||
|
#include "../../vcg/space/point2.h"
|
||||||
|
#include "../../vcg/space/point3.h"
|
||||||
|
#include "../../vcg/space/point4.h"
|
||||||
|
|
||||||
class Shader : public GLObject, public Bindable
|
class Shader : public GLObject, public Bindable
|
||||||
{
|
{
|
||||||
|
|
@ -49,6 +52,9 @@ public:
|
||||||
|
|
||||||
void SetSource(const char * src)
|
void SetSource(const char * src)
|
||||||
{
|
{
|
||||||
|
if (this->objectID==0)
|
||||||
|
Gen();
|
||||||
|
|
||||||
this->flags |= SOURCE_DIRTY;
|
this->flags |= SOURCE_DIRTY;
|
||||||
this->compiled = false;
|
this->compiled = false;
|
||||||
this->source = src;
|
this->source = src;
|
||||||
|
|
@ -59,6 +65,9 @@ public:
|
||||||
|
|
||||||
bool LoadSource(const char * fileName)
|
bool LoadSource(const char * fileName)
|
||||||
{
|
{
|
||||||
|
if (this->objectID==0)
|
||||||
|
Gen();
|
||||||
|
|
||||||
this->flags |= SOURCE_DIRTY;
|
this->flags |= SOURCE_DIRTY;
|
||||||
this->compiled = false;
|
this->compiled = false;
|
||||||
FILE * f = fopen(fileName, "rb");
|
FILE * f = fopen(fileName, "rb");
|
||||||
|
|
@ -375,6 +384,8 @@ public:
|
||||||
|
|
||||||
void Attach(Shader * shd)
|
void Attach(Shader * shd)
|
||||||
{
|
{
|
||||||
|
if (this->objectID==0)
|
||||||
|
Gen();
|
||||||
this->shaders.insert(shd);
|
this->shaders.insert(shd);
|
||||||
this->linked = false;
|
this->linked = false;
|
||||||
glAttachShader(this->objectID, shd->ObjectID());
|
glAttachShader(this->objectID, shd->ObjectID());
|
||||||
|
|
@ -405,15 +416,19 @@ public:
|
||||||
|
|
||||||
bool Link(void)
|
bool Link(void)
|
||||||
{
|
{
|
||||||
|
bool ok = true;
|
||||||
for (std::set<Shader *>::iterator it=this->shaders.begin(); it!=this->shaders.end(); ++it)
|
for (std::set<Shader *>::iterator it=this->shaders.begin(); it!=this->shaders.end(); ++it)
|
||||||
{
|
{
|
||||||
Shader * shd = (*it);
|
Shader * shd = (*it);
|
||||||
if (!shd->IsCompiled())
|
if (!shd->IsCompiled())
|
||||||
{
|
{
|
||||||
shd->Compile();
|
ok = shd->Compile() && ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
return false;
|
||||||
|
|
||||||
glLinkProgram(this->objectID);
|
glLinkProgram(this->objectID);
|
||||||
|
|
||||||
GLint cm = 0;
|
GLint cm = 0;
|
||||||
|
|
@ -487,6 +502,24 @@ public:
|
||||||
glUniform4f(loc, x, y, z, w);
|
glUniform4f(loc, x, y, z, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Uniform(const char * name, const vcg::Point3f& p)
|
||||||
|
{
|
||||||
|
const GLint loc = glGetUniformLocation(this->objectID, name);
|
||||||
|
glUniform2fv(loc, 1, p.V());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Uniform(const char * name, const vcg::Point2f& p)
|
||||||
|
{
|
||||||
|
const GLint loc = glGetUniformLocation(this->objectID, name);
|
||||||
|
glUniform3fv(loc, 1, p.V());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Uniform(const char * name, const vcg::Point4f& p)
|
||||||
|
{
|
||||||
|
const GLint loc = glGetUniformLocation(this->objectID, name);
|
||||||
|
glUniform4fv(loc, 1, p.V());
|
||||||
|
}
|
||||||
|
|
||||||
void Parameter(GLenum pname, int value)
|
void Parameter(GLenum pname, int value)
|
||||||
{
|
{
|
||||||
glProgramParameteriEXT(this->objectID, pname, value);
|
glProgramParameteriEXT(this->objectID, pname, value);
|
||||||
|
|
@ -525,18 +558,26 @@ public:
|
||||||
|
|
||||||
void SetSources(const char * vsrc, const char * fsrc)
|
void SetSources(const char * vsrc, const char * fsrc)
|
||||||
{
|
{
|
||||||
this->vshd.SetSource(vsrc);
|
if (vsrc) {
|
||||||
this->fshd.SetSource(fsrc);
|
this->vshd.SetSource(vsrc);
|
||||||
this->prog.Attach(&(this->vshd));
|
this->prog.Attach(&(this->vshd));
|
||||||
this->prog.Attach(&(this->fshd));
|
}
|
||||||
|
if (fsrc) {
|
||||||
|
this->fshd.SetSource(fsrc);
|
||||||
|
this->prog.Attach(&(this->fshd));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSources(const char * vfile, const char * ffile)
|
void LoadSources(const char * vfile, const char * ffile)
|
||||||
{
|
{
|
||||||
this->vshd.LoadSource(vfile);
|
if (vfile) {
|
||||||
this->fshd.LoadSource(ffile);
|
this->vshd.LoadSource(vfile);
|
||||||
this->prog.Attach(&(this->vshd));
|
this->prog.Attach(&(this->vshd));
|
||||||
this->prog.Attach(&(this->fshd));
|
}
|
||||||
|
if (ffile) {
|
||||||
|
this->fshd.LoadSource(ffile);
|
||||||
|
this->prog.Attach(&(this->fshd));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
* \ *
|
* \ *
|
||||||
* All rights reserved. *
|
* All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
|
|
@ -75,8 +75,8 @@ namespace vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
namespace io {
|
namespace io {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class encapsulate a filter for automatically importing meshes by guessing
|
This class encapsulate a filter for automatically importing meshes by guessing
|
||||||
the right filter according to the extension
|
the right filter according to the extension
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ static bool ErrorCritical(int error)
|
||||||
case KT_OBJ : return ImporterOBJ<OpenMeshType>::ErrorCritical(error); break;
|
case KT_OBJ : return ImporterOBJ<OpenMeshType>::ErrorCritical(error); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *ErrorMsg(int error)
|
static const char *ErrorMsg(int error)
|
||||||
|
|
@ -163,7 +163,7 @@ static const char *ErrorMsg(int error)
|
||||||
case KT_OFF : return ImporterOFF<OpenMeshType>::ErrorMsg(error); break;
|
case KT_OFF : return ImporterOFF<OpenMeshType>::ErrorMsg(error); break;
|
||||||
case KT_OBJ : return ImporterOBJ<OpenMeshType>::ErrorMsg(error); break;
|
case KT_OBJ : return ImporterOBJ<OpenMeshType>::ErrorMsg(error); break;
|
||||||
}
|
}
|
||||||
return "Unknown type";
|
return "Unknown type";
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool LoadMask(const char * filename, int &mask)
|
static bool LoadMask(const char * filename, int &mask)
|
||||||
|
|
@ -192,7 +192,7 @@ static bool LoadMask(const char * filename, int &mask)
|
||||||
err = ImporterOBJ<OpenMeshType>::LoadMask(filename, mask);
|
err = ImporterOBJ<OpenMeshType>::LoadMask(filename, mask);
|
||||||
LastType()=KT_OBJ;
|
LastType()=KT_OBJ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
err = false;
|
err = false;
|
||||||
LastType()=KT_UNKNOWN;
|
LastType()=KT_UNKNOWN;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue