#include <string.h>
#include "mape/cpp-handles/group-handle.h"
#include "mape/cpp-handles/texture-handle.h"
#include "mape/texture.h"
Go to the source code of this file.
Classes | |
struct | _MapeTextureMapPrivate |
Macros | |
#define | MAPE_TEXTURE_MAP_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), MAPE_TYPE_TEXTURE_MAP, MapeTextureMapPrivate)) |
Typedefs | |
typedef struct _MapeTextureMapPrivate | MapeTextureMapPrivate |
Enumerations | |
enum | { PROP_0 , PROP_N_TEXTURES , PROP_OVERLOAD_MATERIALS , PROP_OVERLOAD_TEXTURES } |
Functions | |
C4GroupHandle * | _mape_group_get_handle (MapeGroup *group) |
C4TextureMapHandle * | _mape_texture_map_get_handle (MapeTextureMap *map) |
MapeTextureMap * | mape_texture_map_new (void) |
gboolean | mape_texture_map_load_map (MapeTextureMap *texture_map, MapeGroup *group, GError **error) |
gboolean | mape_texture_map_load_textures (MapeTextureMap *texture_map, MapeGroup *group, GError **error) |
gboolean | mape_texture_map_get_overload_materials (MapeTextureMap *texture_map) |
gboolean | mape_texture_map_get_overload_textures (MapeTextureMap *texture_map) |
guint | mape_texture_map_get_texture_count (MapeTextureMap *texture_map) |
const gchar * | mape_texture_map_get_texture_name (MapeTextureMap *texture_map, guint index) |
. If there is no such | |
texture available in @texture_map then the function returns FALSE. Returns: A #GdkPixbuf corresponding to the texture with the given name. This is owned by the texture map and should not be unrefed or freed. | |
GdkPixbuf * | mape_texture_map_lookup_texture (MapeTextureMap *texture_map, const gchar *name) |
const gchar * | mape_texture_map_get_material_name_from_mapping (MapeTextureMap *texture_map, guint index) |
const gchar * | mape_texture_map_get_texture_name_from_mapping (MapeTextureMap *texture_map, guint index) |
as a | |
32-bit integer. | |
guint32 | mape_texture_map_get_average_texture_color (MapeTextureMap *texture_map, const gchar *name) |
struct _MapeTextureMapPrivate |
Class Members | ||
---|---|---|
C4TextureMapHandle * | handle | |
gboolean | overload_materials | |
gboolean | overload_textures | |
GHashTable * | texture_table |
#define MAPE_TEXTURE_MAP_PRIVATE | ( | obj | ) | (G_TYPE_INSTANCE_GET_PRIVATE((obj), MAPE_TYPE_TEXTURE_MAP, MapeTextureMapPrivate)) |
typedef struct _MapeTextureMapPrivate MapeTextureMapPrivate |
anonymous enum |
C4GroupHandle* _mape_group_get_handle | ( | MapeGroup * | group | ) |
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.
References MAPE_GROUP_PRIVATE, and MAPE_IS_GROUP.
Referenced by mape_texture_map_load_map().
C4TextureMapHandle* _mape_texture_map_get_handle | ( | MapeTextureMap * | map | ) |
Definition at line 591 of file texture.c.
References MAPE_IS_TEXTURE_MAP, and MAPE_TEXTURE_MAP_PRIVATE.
Referenced by mape_mapgen_render(), and mape_material_map_set_default_textures().
guint32 mape_texture_map_get_average_texture_color | ( | MapeTextureMap * | texture_map, |
const gchar * | name | ||
) |
Definition at line 580 of file texture.c.
References c4_texture_handle_get_average_texture_color(), _MapeTextureMapPrivate::handle, MAPE_IS_TEXTURE_MAP, and MAPE_TEXTURE_MAP_PRIVATE.
const gchar* mape_texture_map_get_material_name_from_mapping | ( | MapeTextureMap * | texture_map, |
guint | index | ||
) |
mape_texture_map_get_material_name_from_mapping: @texture_map: A MapeTextureMap. @index: A material-texture combination index.
Returns the name of the material which corresponds to the given index in the material-texture mapping. The function returns NULL if the corresponding entry is empty. The mapping must be loaded with the function mape_texture_map_load_map() before this function can be used.
Returns: The name of the material which corresponds to the given index, or NULL.
Definition at line 536 of file texture.c.
References c4_texture_handle_get_entry_material_name(), _MapeTextureMapPrivate::handle, MAPE_IS_TEXTURE_MAP, and MAPE_TEXTURE_MAP_PRIVATE.
gboolean mape_texture_map_get_overload_materials | ( | MapeTextureMap * | texture_map | ) |
mape_texture_map_get_overload_materials: @texture_map: A MapeTextureMap.
Returns whether the OverloadMaterials flag is set in the mapping. This flag is initialized by calling mape_texture_map_load_map().
Returns: Whether the OverloadMaterials flag is set in the mapping.
Definition at line 427 of file texture.c.
References MAPE_IS_TEXTURE_MAP, and MAPE_TEXTURE_MAP_PRIVATE.
gboolean mape_texture_map_get_overload_textures | ( | MapeTextureMap * | texture_map | ) |
mape_texture_map_get_overload_textures: @texture_map: A MapeTextureMap.
Returns whether the OverloadTextures flag is set in the mapping. This flag is initialized by calling mape_texture_map_load_map().
Returns: Whether the OverloadTextures flag is set in the mapping.
Definition at line 443 of file texture.c.
References MAPE_IS_TEXTURE_MAP, and MAPE_TEXTURE_MAP_PRIVATE.
guint mape_texture_map_get_texture_count | ( | MapeTextureMap * | texture_map | ) |
mape_texture_map_get_texture_count: @texture_map: A MapeTextureMap.
Returns the number of textures loaded. This will only be non-zero after mape_texture_map_load_textures() was called.
Returns: The number of textures loaded.
Definition at line 459 of file texture.c.
References MAPE_IS_TEXTURE_MAP, MAPE_TEXTURE_MAP_PRIVATE, and _MapeTextureMapPrivate::texture_table.
Referenced by mape_mat_tex_view_reload(), and mape_texture_map_get_texture_name().
const gchar* mape_texture_map_get_texture_name | ( | MapeTextureMap * | texture_map, |
guint | index | ||
) |
mape_texture_map_get_texture_name: @texture_map: A MapeTextureMap. @index: The index of the texture whose name to retrieve.
Returns the name of the @index<– -->th material in @texture_map. Allowed values for @index range from 0 to mape_texture_map_get_texture_count() - 1.
Returns: The texture name of the texture corresponding to @index.
Definition at line 478 of file texture.c.
References c4_texture_map_handle_get_texture(), _MapeTextureMapPrivate::handle, MAPE_IS_TEXTURE_MAP, mape_texture_map_get_texture_count(), and MAPE_TEXTURE_MAP_PRIVATE.
Referenced by mape_mat_tex_view_reload().
const gchar* mape_texture_map_get_texture_name_from_mapping | ( | MapeTextureMap * | texture_map, |
guint | index | ||
) |
mape_texture_map_get_texture_name_from_mapping: @texture_map: A MapeTextureMap. @index: A material-texture combination index.
Returns the name of the texture which corresponds to the given index in the material-texture mapping. The function returns NULL if the corresponding entry is empty. The mapping must be loaded with the function mape_texture_map_load_map() before this function can be used.
Returns: The name of the texture which corresponds to the given index, or NULL.
Definition at line 559 of file texture.c.
References c4_texture_handle_get_entry_texture_name(), _MapeTextureMapPrivate::handle, MAPE_IS_TEXTURE_MAP, and MAPE_TEXTURE_MAP_PRIVATE.
gboolean mape_texture_map_load_map | ( | MapeTextureMap * | texture_map, |
MapeGroup * | group, | ||
GError ** | error | ||
) |
mape_texture_map_load_map: @texture_map: A MapeTextureMap. @group: A MapeGroup to load the material mappings from. @error: Location to store error information, if any.
Loads the mappings of material-texture combinations to palette indices from the group's TexMap.txt. This should only be loaded once per group. If an error occurs, @error is set and the function returns FALSE.
Returns: TRUE if the mapping could be loaded or FALSE otherwise.
Definition at line 265 of file texture.c.
References _mape_group_get_handle(), c4_texture_map_handle_load_map(), _MapeTextureMapPrivate::handle, MAPE_IS_GROUP, MAPE_IS_TEXTURE_MAP, MAPE_TEXTURE_MAP_PRIVATE, _MapeTextureMapPrivate::overload_materials, and _MapeTextureMapPrivate::overload_textures.
Referenced by mape_mat_tex_view_reload().
gboolean mape_texture_map_load_textures | ( | MapeTextureMap * | texture_map, |
MapeGroup * | group, | ||
GError ** | error | ||
) |
mape_texture_map_load_textures: @texture_map: A MapeTextureMap. @group: The group to load textures from. @error: Location to store error information, if any.
Loads all textures in @group. If this includes textures which are already contained in @texture_map, then these textures will not be loaded. If an error occurs, @error is set and the function returns FALSE.
Returns: TRUE if the textures could be loaded or FALSE otherwise.
Definition at line 304 of file texture.c.
References c4_texture_map_handle_add_texture(), _MapeTextureMapPrivate::handle, mape_group_get_next_entry(), mape_group_load_entry(), mape_group_rewind(), MAPE_IS_GROUP, MAPE_IS_TEXTURE_MAP, MAPE_TEXTURE_MAP_PRIVATE, and _MapeTextureMapPrivate::texture_table.
Referenced by mape_mat_tex_view_reload().
GdkPixbuf* mape_texture_map_lookup_texture | ( | MapeTextureMap * | texture_map, |
const gchar * | name | ||
) |
Definition at line 504 of file texture.c.
References MAPE_IS_TEXTURE_MAP, MAPE_TEXTURE_MAP_PRIVATE, and _MapeTextureMapPrivate::texture_table.
Referenced by mape_mat_tex_view_reload().
MapeTextureMap* mape_texture_map_new | ( | void | ) |
mape_texture_map_new:
Creates a new MapeTextureMap. The map is initially empty. Use mape_texture_map_load_map() to load mappings and mape_texture_map_load_textures() from a Material.ocg group file.
Return Value: A new MapeTextureMap. Free with g_object_unref().
Definition at line 247 of file texture.c.
References MAPE_TEXTURE_MAP, and MAPE_TYPE_TEXTURE_MAP.