OpenClonk
texture-handle.h File Reference
#include <glib.h>
#include "mape/cpp-handles/group-handle.h"
Include dependency graph for texture-handle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef typedefG_BEGIN_DECLS struct _C4TextureMapHandle C4TextureMapHandle
 

Functions

C4TextureMapHandlec4_texture_map_handle_new (void)
 
void c4_texture_map_handle_free (C4TextureMapHandle *texture_map)
 
guint c4_texture_map_handle_load_map (C4TextureMapHandle *texture_map, C4GroupHandle *group, const char *entry_name, gboolean *overload_materials, gboolean *overload_textures)
 
gboolean c4_texture_map_handle_add_texture (C4TextureMapHandle *texture_map, const char *texture, guint32 avg_color)
 
const char * c4_texture_map_handle_get_texture (C4TextureMapHandle *texture_map, guint index)
 
const char * c4_texture_handle_get_entry_material_name (C4TextureMapHandle *texture_map, guint index)
 
const char * c4_texture_handle_get_entry_texture_name (C4TextureMapHandle *texture_map, guint index)
 
guint32 c4_texture_handle_get_average_texture_color (C4TextureMapHandle *texture_map, const char *name)
 

Typedef Documentation

◆ C4TextureMapHandle

typedef typedefG_BEGIN_DECLS struct _C4TextureMapHandle C4TextureMapHandle

Definition at line 23 of file texture-handle.h.

Function Documentation

◆ c4_texture_handle_get_average_texture_color()

guint32 c4_texture_handle_get_average_texture_color ( C4TextureMapHandle texture_map,
const char *  name 
)

Definition at line 68 of file texture-handle.cpp.

69 {
70  return HANDLE_TO_TEXTURE_MAP(texture_map)->GetTexture(name)->GetAverageColor();
71 }
#define HANDLE_TO_TEXTURE_MAP(handle)

References HANDLE_TO_TEXTURE_MAP.

Referenced by mape_texture_map_get_average_texture_color().

Here is the caller graph for this function:

◆ c4_texture_handle_get_entry_material_name()

const char* c4_texture_handle_get_entry_material_name ( C4TextureMapHandle texture_map,
guint  index 
)

Definition at line 73 of file texture-handle.cpp.

74 {
75  const C4TexMapEntry* entry = HANDLE_TO_TEXTURE_MAP(texture_map)->GetEntry(index);
76  if(!entry) return nullptr;
77  return entry->GetMaterialName();
78 }
Definition: C4Texture.h:49
const char * GetMaterialName() const
Definition: C4Texture.h:60

References C4TexMapEntry::GetMaterialName(), and HANDLE_TO_TEXTURE_MAP.

Referenced by mape_texture_map_get_material_name_from_mapping().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ c4_texture_handle_get_entry_texture_name()

const char* c4_texture_handle_get_entry_texture_name ( C4TextureMapHandle texture_map,
guint  index 
)

Definition at line 80 of file texture-handle.cpp.

81 {
82  const C4TexMapEntry* entry = HANDLE_TO_TEXTURE_MAP(texture_map)->GetEntry(index);
83  if(!entry) return nullptr;
84  return entry->GetTextureName();
85 }
const char * GetTextureName() const
Definition: C4Texture.h:61

References C4TexMapEntry::GetTextureName(), and HANDLE_TO_TEXTURE_MAP.

Referenced by mape_texture_map_get_texture_name_from_mapping().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ c4_texture_map_handle_add_texture()

gboolean c4_texture_map_handle_add_texture ( C4TextureMapHandle texture_map,
const char *  texture,
guint32  avg_color 
)

Definition at line 55 of file texture-handle.cpp.

56 {
57  gboolean result = HANDLE_TO_TEXTURE_MAP(texture_map)->AddTexture(texture, nullptr);
58  if(!result) return FALSE;
59  HANDLE_TO_TEXTURE_MAP(texture_map)->GetTexture(texture)->SetAverageColor(avg_color);
60  return TRUE;
61 }

References HANDLE_TO_TEXTURE_MAP.

Referenced by mape_texture_map_load_textures().

Here is the caller graph for this function:

◆ c4_texture_map_handle_free()

void c4_texture_map_handle_free ( C4TextureMapHandle texture_map)

Definition at line 40 of file texture-handle.cpp.

41 {
42  //delete HANDLE_TO_TEXTURE_MAP(texture_map);
43 }

◆ c4_texture_map_handle_get_texture()

const char* c4_texture_map_handle_get_texture ( C4TextureMapHandle texture_map,
guint  index 
)

Definition at line 63 of file texture-handle.cpp.

64 {
65  return HANDLE_TO_TEXTURE_MAP(texture_map)->GetTexture(index);
66 }

References HANDLE_TO_TEXTURE_MAP.

Referenced by mape_texture_map_get_texture_name().

Here is the caller graph for this function:

◆ c4_texture_map_handle_load_map()

guint c4_texture_map_handle_load_map ( C4TextureMapHandle texture_map,
C4GroupHandle group,
const char *  entry_name,
gboolean *  overload_materials,
gboolean *  overload_textures 
)

Definition at line 45 of file texture-handle.cpp.

46 {
47  bool fOverloadMaterials = false;
48  bool fOverloadTextures = false;
49  guint32 retval = HANDLE_TO_TEXTURE_MAP(texture_map)->LoadMap(*HANDLE_TO_GROUP(group), entry_name, &fOverloadMaterials, &fOverloadTextures);
50  if(overload_materials) *overload_materials = fOverloadMaterials;
51  if(overload_textures) *overload_textures = fOverloadTextures;
52  return retval;
53 }
#define HANDLE_TO_GROUP(handle)

References HANDLE_TO_GROUP, and HANDLE_TO_TEXTURE_MAP.

Referenced by mape_texture_map_load_map().

Here is the caller graph for this function:

◆ c4_texture_map_handle_new()

C4TextureMapHandle* c4_texture_map_handle_new ( void  )

Definition at line 28 of file texture-handle.cpp.

29 {
30  // Simply return a pointer to the global texture map. This is a bit stupid,
31  // but some functions in C4Landscape use the global texture map when looking
32  // up textures. This should be changed to get rid of the global variable,
33  //but yeah...
34  C4TextureMap* map = &::TextureMap;
35  map->Clear();
36  map->Init();
37  return TEXTURE_MAP_TO_HANDLE(map); //new C4TextureMap);
38 }
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
int32_t Init()
Definition: C4Texture.cpp:292
void Clear()
Definition: C4Texture.cpp:168
#define TEXTURE_MAP_TO_HANDLE(texture_map)

References C4TextureMap::Clear(), C4TextureMap::Init(), TEXTURE_MAP_TO_HANDLE, and TextureMap.

Here is the call graph for this function: