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.


struct  C4Landscape::P


int32_t PixCol2Mat (BYTE pixc)

Function Documentation

◆ PixCol2Mat()

int32_t PixCol2Mat ( BYTE  pixc)

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

References C4M_MaxTexIndex, C4TextureMap::GetEntry(), C4TexMapEntry::GetMaterialIndex(), C4Landscape::HandleTexMapUpdate(), C4MaterialCore::Light, C4MaterialMap::Map, MatDensity(), MaterialMap, MatValid(), MNone, PixCol2Tex(), C4MaterialCore::Placement, TextureMap, and C4Landscape::UpdatePixMaps().

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 }
C4TextureMap TextureMap
Definition: C4Texture.cpp:576
Definition: C4Texture.h:48
const C4TexMapEntry * GetEntry(int32_t iIndex) const
Definition: C4Texture.h:85
const int32_t MNone
Definition: C4Constants.h:177
int32_t PixCol2Tex(BYTE pixc)
Definition: C4Landscape.h:211
int32_t GetMaterialIndex() const
Definition: C4Texture.h:62
Here is the call graph for this function: