OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
landscape-handle.cpp File Reference
#include "C4Include.h"
#include <array>
#include "graphics/CSurface8.h"
#include "landscape/C4Landscape.h"
#include "landscape/C4Texture.h"
Include dependency graph for landscape-handle.cpp:

Go to the source code of this file.

Classes

struct  C4Landscape::P
 

Functions

int32_t PixCol2Mat (BYTE pixc)
 

Function Documentation

int32_t PixCol2Mat ( BYTE  pixc)

Definition at line 59 of file landscape-handle.cpp.

References C4TextureMap::GetEntry(), C4TexMapEntry::GetMaterialIndex(), MNone, PixCol2Tex(), and TextureMap.

60 {
61  // Get texture
62  int32_t iTex = PixCol2Tex(pixc);
63  if (!iTex) return MNone;
64  // Get material-texture mapping
65  const C4TexMapEntry *pTex = ::TextureMap.GetEntry(iTex);
66  // Return material
67  return pTex ? pTex->GetMaterialIndex() : MNone;
68 }
int32_t GetMaterialIndex() const
Definition: C4Texture.h:62
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
const C4TexMapEntry * GetEntry(int32_t iIndex) const
Definition: C4Texture.h:85
Definition: C4Texture.h:48
const int32_t MNone
Definition: C4Constants.h:178
int32_t PixCol2Tex(BYTE pixc)
Definition: C4Landscape.h:213

Here is the call graph for this function: