Load Texture information from obj
git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@98 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2003 by Computer Graphics Group, RWTH Aachen *
|
||||
* www.openmesh.org *
|
||||
* *
|
||||
*---------------------------------------------------------------------------*
|
||||
*---------------------------------------------------------------------------*
|
||||
* *
|
||||
* License *
|
||||
* *
|
||||
@@ -60,7 +60,7 @@ namespace IO {
|
||||
//== IMPLEMENTATION ===========================================================
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
Implementation of the OBJ format reader.
|
||||
*/
|
||||
class _OBJReader_ : public BaseReader
|
||||
@@ -73,9 +73,9 @@ public:
|
||||
|
||||
std::string get_description() const { return "Alias/Wavefront"; }
|
||||
std::string get_extensions() const { return "obj"; }
|
||||
|
||||
bool read(const std::string& _filename,
|
||||
BaseImporter& _bi,
|
||||
|
||||
bool read(const std::string& _filename,
|
||||
BaseImporter& _bi,
|
||||
Options& _opt);
|
||||
|
||||
private:
|
||||
@@ -89,43 +89,53 @@ private:
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
Kd_is_set_ = false;
|
||||
Ka_is_set_ = false;
|
||||
Ks_is_set_ = false;
|
||||
Tr_is_set_ = false;
|
||||
Kd_is_set_ = false;
|
||||
Ka_is_set_ = false;
|
||||
Ks_is_set_ = false;
|
||||
Tr_is_set_ = false;
|
||||
map_Kd_is_set_ = false;
|
||||
}
|
||||
|
||||
bool is_valid(void) const
|
||||
bool is_valid(void) const
|
||||
{ return Kd_is_set_ || Ka_is_set_ || Ks_is_set_ || Tr_is_set_; }
|
||||
|
||||
bool has_Kd(void) { return Kd_is_set_; }
|
||||
bool has_Ka(void) { return Ka_is_set_; }
|
||||
bool has_Ks(void) { return Ks_is_set_; }
|
||||
bool has_Tr(void) { return Tr_is_set_; }
|
||||
|
||||
void set_Kd( float r, float g, float b )
|
||||
bool has_Kd(void) { return Kd_is_set_; }
|
||||
bool has_Ka(void) { return Ka_is_set_; }
|
||||
bool has_Ks(void) { return Ks_is_set_; }
|
||||
bool has_Tr(void) { return Tr_is_set_; }
|
||||
bool has_map_Kd(void) { return map_Kd_is_set_; }
|
||||
|
||||
void set_Kd( float r, float g, float b )
|
||||
{ Kd_=Vec3f(r,g,b); Kd_is_set_=true; }
|
||||
|
||||
void set_Ka( float r, float g, float b )
|
||||
void set_Ka( float r, float g, float b )
|
||||
{ Ka_=Vec3f(r,g,b); Ka_is_set_=true; }
|
||||
|
||||
void set_Ks( float r, float g, float b )
|
||||
void set_Ks( float r, float g, float b )
|
||||
{ Ks_=Vec3f(r,g,b); Ks_is_set_=true; }
|
||||
|
||||
|
||||
void set_Tr( float t )
|
||||
{ Tr_=t; Tr_is_set_=true; }
|
||||
|
||||
|
||||
void set_map_Kd( std::string _name, int _index_Kd )
|
||||
{ map_Kd_ = _name, index_Kd_ = _index_Kd; map_Kd_is_set_ = true; };
|
||||
|
||||
const Vec3f& Kd( void ) const { return Kd_; }
|
||||
const Vec3f& Ka( void ) const { return Ka_; }
|
||||
const Vec3f& Ks( void ) const { return Ks_; }
|
||||
float Tr( void ) const { return Tr_; }
|
||||
|
||||
const std::string& map_Kd( void ) { return map_Kd_ ; }
|
||||
const int& map_Kd_index( void ) { return index_Kd_ ; }
|
||||
|
||||
private:
|
||||
|
||||
Vec3f Kd_; bool Kd_is_set_; // diffuse
|
||||
Vec3f Ka_; bool Ka_is_set_; // ambient
|
||||
Vec3f Ks_; bool Ks_is_set_; // specular
|
||||
float Tr_; bool Tr_is_set_; // transperency
|
||||
Vec3f Kd_; bool Kd_is_set_; // diffuse
|
||||
Vec3f Ka_; bool Ka_is_set_; // ambient
|
||||
Vec3f Ks_; bool Ks_is_set_; // specular
|
||||
float Tr_; bool Tr_is_set_; // transperency
|
||||
|
||||
std::string map_Kd_; int index_Kd_; bool map_Kd_is_set_; // Texture
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user