#include "mape/cpp-handles/group-handle.h"
#include "mape/cpp-handles/material-handle.h"
#include "mape/material.h"
Go to the source code of this file.
Classes | |
struct | _MapeMaterialMapPrivate |
Macros | |
#define | MAPE_MATERIAL_MAP_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), MAPE_TYPE_MATERIAL_MAP, MapeMaterialMapPrivate)) |
Typedefs | |
typedef struct _MapeMaterialMapPrivate | MapeMaterialMapPrivate |
Enumerations | |
enum | { PROP_0 , PROP_N_MATERIALS } |
Functions | |
C4GroupHandle * | _mape_group_get_handle (MapeGroup *group) |
C4MaterialMapHandle * | _mape_material_map_get_handle (MapeMaterialMap *map) |
C4TextureMapHandle * | _mape_texture_map_get_handle (MapeTextureMap *map) |
GType | mape_material_get_type (void) |
MapeMaterialMap * | mape_material_map_new (void) |
gboolean | mape_material_map_load (MapeMaterialMap *map, MapeGroup *from, GError **error) |
guint | mape_material_map_get_material_count (MapeMaterialMap *map) |
void | mape_material_map_set_default_textures (MapeMaterialMap *matmap, MapeTextureMap *texmap) |
const MapeMaterial * | mape_material_map_get_material (MapeMaterialMap *map, guint index) |
MapeMaterial * | mape_material_map_get_material_by_name (MapeMaterialMap *map, const gchar *name) |
const gchar * | mape_material_get_name (const MapeMaterial *material) |
const gchar * | mape_material_get_texture_overlay (const MapeMaterial *material) |
struct _MapeMaterialMapPrivate |
Definition at line 44 of file material.c.
Class Members | ||
---|---|---|
C4MaterialMapHandle * | handle |
#define MAPE_MATERIAL_MAP_PRIVATE | ( | obj | ) | (G_TYPE_INSTANCE_GET_PRIVATE((obj), MAPE_TYPE_MATERIAL_MAP, MapeMaterialMapPrivate)) |
Definition at line 55 of file material.c.
typedef struct _MapeMaterialMapPrivate MapeMaterialMapPrivate |
Definition at line 41 of file material.c.
anonymous enum |
C4GroupHandle* _mape_group_get_handle | ( | MapeGroup * | group | ) |
SECTION:mape-material-map @title: MapeMaterialMap @short_description: C4MaterialMap interface mape/material.h @stability: Unstable
MapeMaterialMap is a simple GObject-based interface to C4MaterialMap. It supports loading a material map from a Material.ocg group file. It can load multiple files, with newer entries overloading previous ones in case of name clashes to support material overloading.
SECTION:mape-group @title: MapeGroup @short_description: C4Group interface mape/group.h @stability: Unstable
MapeGroup is a simple GObject-based interface to C4Group. It currntly only supports a subset of the C4Group operations, it does not support writing groups for example. It is just enough for what Mape requires.
Definition at line 682 of file group.c.
Referenced by mape_material_map_load().
C4MaterialMapHandle* _mape_material_map_get_handle | ( | MapeMaterialMap * | map | ) |
Definition at line 396 of file material.c.
References MAPE_IS_MATERIAL_MAP, and MAPE_MATERIAL_MAP_PRIVATE.
Referenced by mape_mapgen_render().
C4TextureMapHandle* _mape_texture_map_get_handle | ( | MapeTextureMap * | map | ) |
Definition at line 591 of file texture.c.
Referenced by mape_material_map_set_default_textures().
const gchar* mape_material_get_name | ( | const MapeMaterial * | material | ) |
mape_material_get_name: @material: A MapeMaterial.
Returns the material's name.
Return Value: The name of the material. The string is owned by the MapeMaterial and must not be freed by the user.
Definition at line 371 of file material.c.
References c4_material_handle_get_name().
Referenced by mape_mat_tex_view_reload().
const gchar* mape_material_get_texture_overlay | ( | const MapeMaterial * | material | ) |
mape_material_get_texture_overlay: @material: A MapeMaterial.
Returns the material's texture overlay as a string. This can be used to make a texture lookup in a corresponding MapeTextureMap.
Return Value: The texture overlay of the material. The string is owned by the MapeMaterial and must not be freed by the user.
Definition at line 388 of file material.c.
References c4_material_handle_get_texture_overlay().
GType mape_material_get_type | ( | void | ) |
Definition at line 194 of file material.c.
const MapeMaterial* mape_material_map_get_material | ( | MapeMaterialMap * | map, |
guint | index | ||
) |
mape_material_map_get_material: @map: A MapeMaterialMap. @index: A material index.
Returns the entry with the given index in the map.
Returns: A MapeMaterial representing the indexed material. It is owned by #map and must not be used anymore after the map is finalized.
Definition at line 310 of file material.c.
References c4_material_map_handle_get_num(), _MapeMaterialMapPrivate::handle, MAPE_IS_MATERIAL_MAP, and MAPE_MATERIAL_MAP_PRIVATE.
Referenced by mape_mat_tex_view_reload().
MapeMaterial* mape_material_map_get_material_by_name | ( | MapeMaterialMap * | map, |
const gchar * | name | ||
) |
Definition at line 336 of file material.c.
References c4_material_handle_get_name(), c4_material_map_handle_get_material(), c4_material_map_handle_get_num(), _MapeMaterialMapPrivate::handle, MAPE_IS_MATERIAL_MAP, and MAPE_MATERIAL_MAP_PRIVATE.
guint mape_material_map_get_material_count | ( | MapeMaterialMap * | map | ) |
mape_material_map_get_material_count: @map: A MapeMaterialMap.
Returns the number of materials contained in @map.
Return Value: The number of materials in @map.
Definition at line 274 of file material.c.
References c4_material_map_handle_get_num(), MAPE_IS_MATERIAL_MAP, and MAPE_MATERIAL_MAP_PRIVATE.
Referenced by mape_mat_tex_view_reload().
gboolean mape_material_map_load | ( | MapeMaterialMap * | map, |
MapeGroup * | from, | ||
GError ** | error | ||
) |
mape_material_map_load: @map: A MapeMaterialMap. @from: An open MapeGroup to load materials from. @error: Location to store error information, if any.
Loads all the material files (*.c4m) from the group @from. If this includes materials with the same name as materials already contained in @map, then the new materials will not be loaded. If an error occurs while loading the material map the function returns FALSE and @error is set.
Returns: TRUE on success, FALSE on failure.
Definition at line 242 of file material.c.
References _mape_group_get_handle(), c4_material_map_handle_load(), _MapeMaterialMapPrivate::handle, mape_group_is_open(), MAPE_IS_GROUP, MAPE_IS_MATERIAL_MAP, and MAPE_MATERIAL_MAP_PRIVATE.
Referenced by mape_mat_tex_view_reload().
MapeMaterialMap* mape_material_map_new | ( | void | ) |
mape_material_map_new:
Creates a new MapeMaterialMap. The map is initially empty. Use mape_material_map_load() to load materials from one or more Material.ocg group files.
Return Value: A new MapeMaterialMap. Free with g_object_unref().
Definition at line 223 of file material.c.
References MAPE_MATERIAL_MAP, and MAPE_TYPE_MATERIAL_MAP.
Referenced by mape_mat_tex_view_reload().
void mape_material_map_set_default_textures | ( | MapeMaterialMap * | matmap, |
MapeTextureMap * | texmap | ||
) |
mape_material_map_set_default_textures: @mapmap: A MapeMaterialMap. @texmap: A MapeTextureMap to load textures from.
Sets the default textures for the materials in @matmap by looking up the texture overlay specified in the material file in @texmap.
Definition at line 290 of file material.c.
References _mape_texture_map_get_handle(), c4_material_map_crossmap_materials(), and MAPE_MATERIAL_MAP_PRIVATE.
Referenced by mape_mat_tex_view_reload().