Stellarium  0.18.3
Public Types | Static Public Member Functions | Data Fields | Static Protected Member Functions
StelOBJ::Material Struct Reference

Defines a material loaded from an .mtl file. More...

#include <StelOBJ.hpp>

Public Types

enum  Illum {
  I_NONE =-1, I_DIFFUSE =0, I_DIFFUSE_AND_AMBIENT =1, I_SPECULAR =2,
  I_TRANSLUCENT =9
}
 MTL Illumination models, see the developer doc for info. More...
 
typedef QMap< QString, QStringList > ParamsMap
 

Static Public Member Functions

static QVector< MaterialloadFromFile (const QString &filename)
 Loads all materials contained in an .mtl file. More...
 

Data Fields

enum StelOBJ::Material::Illum illum
 
QString name
 Name of the material as defined in the .mtl, default empty.
 
QVector3D Ka
 Ambient coefficient. Contains all -1 if not set by .mtl.
 
QVector3D Kd
 Diffuse coefficient. Contains all -1 if not set by .mtl.
 
QVector3D Ks
 Specular coefficient. Contains all -1 if not set by .mtl.
 
QVector3D Ke
 Emissive coefficient. Contains all -1 if not set by .mtl.
 
float Ns
 Specular shininess (exponent), should be > 0. Default 8.0.
 
float d
 Alpha value (1 means opaque). More...
 
QString map_Ka
 The ambient texture map file path.
 
QString map_Kd
 The diffuse texture map file path.
 
QString map_Ks
 The specular texture map file path.
 
QString map_Ke
 The emissive texture map file path.
 
QString map_bump
 The bump/normal texture map file path.
 
QString map_height
 The height map texture file path.
 
ParamsMap additionalParams
 Contains all other material parameters that are not recognized by this class, but can still be accessed by class users this way. More...
 

Static Protected Member Functions

static bool parseBool (const QStringList &params, bool &out)
 Parses a bool from a parameter list (like included in the ::additionalParams) using the same logic StelOBJ uses internally. More...
 
static bool parseFloat (const QStringList &params, float &out)
 Parses a float from a parameter list (like included in the ::additionalParams) using the same logic StelOBJ uses internally. More...
 
static bool parseVec2d (const QStringList &params, Vec2d &out)
 Parses a Vec2d from a parameter list (like included in the ::additionalParams) using the same logic StelOBJ uses internally. More...
 

Detailed Description

It uses QVector3D instead of Vec3f, etc, to be more compatible with Qt's OpenGL wrappers.

Member Enumeration Documentation

◆ Illum

Deprecated:
If possible, do not use. Illum use is very inconsistent between different modeling programs

Member Function Documentation

◆ loadFromFile()

static QVector<Material> StelOBJ::Material::loadFromFile ( const QString &  filename)
static

Does not check if the texture map files exist.

Returns
empty vector on error

◆ parseBool()

static bool StelOBJ::Material::parseBool ( const QStringList &  params,
bool &  out 
)
staticprotected
Returns
true if successful, the output is written into out

◆ parseFloat()

static bool StelOBJ::Material::parseFloat ( const QStringList &  params,
float &  out 
)
staticprotected
Returns
true if successful, the output is written into out

◆ parseVec2d()

static bool StelOBJ::Material::parseVec2d ( const QStringList &  params,
Vec2d out 
)
staticprotected
Returns
true if successful, the output is written into out

Field Documentation

◆ additionalParams

ParamsMap StelOBJ::Material::additionalParams

The key is the statement name (e.g. Ka, map_bump etc.), the value is the list of space-separated parameters to this statement

◆ d

float StelOBJ::Material::d

-1 if not set by .mtl Note that both the d and Tr statements can change this value