Skip to content

Commit

Permalink
libgui|ModelDrawable: Normal and height maps
Browse files Browse the repository at this point in the history
The vertex data handled my ModelDrawable now contains information for
specifying the normal map for the geometry. This can come from the
model file (if specified), or it can use a common default normal map
(e.g., simple +Z vector). Also, one can manually specify a custom file
as the normal map.
  • Loading branch information
skyjake committed Aug 11, 2014
1 parent 8949227 commit 3a08f2b
Show file tree
Hide file tree
Showing 2 changed files with 276 additions and 30 deletions.
33 changes: 33 additions & 0 deletions doomsday/libgui/include/de/graphics/modeldrawable.h
Expand Up @@ -45,6 +45,13 @@ class LIBGUI_PUBLIC ModelDrawable : public AssetGroup
/// An error occurred during the loading of the model data. @ingroup errors
DENG2_ERROR(LoadError);

enum TextureMap
{
Diffuse,
Normals,
Height
};

/**
* Animation state for a model. There can be any number of ongoing animations,
* targeting individual nodes of a model.
Expand Down Expand Up @@ -196,6 +203,32 @@ class LIBGUI_PUBLIC ModelDrawable : public AssetGroup
*/
void unsetAtlas();

/**
* Sets the normal map that is used if no other normals are provided.
*
* @param atlasId Identifier in the atlas.
*/
void setDefaultNormals(Id const &atlasId);

/**
* Locates a material specified in the model by its name.
*
* @param name Name of the material
*
* @return Material id.
*/
int materialId(String const &name) const;

/**
* Sets or changes one of the texture maps used by the model. This can be used to
* override the maps set up automatically by glInit().
*
* @param materialId Which material to modify.
* @param textureMap Texture to set.
* @param path Path of the texture image.
*/
void setTexturePath(int materialId, TextureMap textureMap, String const &path);

/**
* Sets the GL program used for shading the model.
*
Expand Down

0 comments on commit 3a08f2b

Please sign in to comment.