OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4DefAdditionalResourcesLoader Class Reference
Inheritance diagram for C4DefAdditionalResourcesLoader:
[legend]
Collaboration diagram for C4DefAdditionalResourcesLoader:
[legend]

Public Member Functions

 C4DefAdditionalResourcesLoader (C4Group &hGroup)
 
virtual C4SurfaceLoadTexture (const char *filename)
 
virtual StdStrBuf LoadShaderCode (const char *filename)
 
virtual void AddShaderSlices (C4Shader &shader, int ssc)
 

Detailed Description

Definition at line 42 of file C4Def.cpp.

Constructor & Destructor Documentation

C4DefAdditionalResourcesLoader::C4DefAdditionalResourcesLoader ( C4Group hGroup)
inline

Definition at line 45 of file C4Def.cpp.

45 : Group(hGroup) {}

Member Function Documentation

virtual void C4DefAdditionalResourcesLoader::AddShaderSlices ( C4Shader shader,
int  ssc 
)
inlinevirtual

Implements StdMeshMaterialLoader.

Definition at line 65 of file C4Def.cpp.

References C4Shader::AddDefine(), C4GraphicsResource::Files, GraphicsResource, C4Shader::LoadFragmentSlices(), and C4Shader::SetScriptCategories().

66  {
67 #ifndef USE_CONSOLE
68  // Add mesh-independent slices
69  shader.AddDefine("OPENCLONK");
70  shader.AddDefine("OC_MESH");
71 
72  if (ssc & C4SSC_MOD2) shader.AddDefine("OC_CLRMOD_MOD2");
73  if (ssc & C4SSC_LIGHT) shader.AddDefine("OC_DYNAMIC_LIGHT");
74 
75  // Note these are never set for meshes at the moment:
76  if (ssc & C4SSC_BASE) shader.AddDefine("OC_HAVE_BASE");
77  if (ssc & C4SSC_OVERLAY) shader.AddDefine("OC_HAVE_OVERLAY");
78 
79  shader.LoadFragmentSlices(&::GraphicsResource.Files, "CommonShader.glsl");
80  shader.LoadFragmentSlices(&::GraphicsResource.Files, "ObjectShader.glsl");
81 
82  // Categories for script shaders.
83  shader.SetScriptCategories({"Common", "Object"});
84 #endif
85  }
void SetScriptCategories(const std::vector< std::string > &categories)
Definition: C4Shader.cpp:104
bool LoadFragmentSlices(C4GroupSet *pGroupSet, const char *szFile)
Definition: C4Shader.cpp:94
void AddDefine(const char *name)
Definition: C4Shader.cpp:67
C4GraphicsResource GraphicsResource

Here is the call graph for this function:

virtual StdStrBuf C4DefAdditionalResourcesLoader::LoadShaderCode ( const char *  filename)
inlinevirtual

Implements StdMeshMaterialLoader.

Definition at line 58 of file C4Def.cpp.

References C4Group::LoadEntryString().

59  {
60  StdStrBuf ret;
61  if (!Group.LoadEntryString(filename, &ret)) return StdStrBuf();
62  return ret;
63  }
bool LoadEntryString(const char *szEntryName, StdStrBuf *Buf)
Definition: C4Group.cpp:1932

Here is the call graph for this function:

virtual C4Surface* C4DefAdditionalResourcesLoader::LoadTexture ( const char *  filename)
inlinevirtual

Implements StdMeshMaterialLoader.

Definition at line 47 of file C4Def.cpp.

References C4Group::AccessEntry(), C4SF_MipMap, GetExtension(), and C4Surface::Read().

48  {
49  if (!Group.AccessEntry(filename)) return nullptr;
50  C4Surface* surface = new C4Surface;
51  // Suppress error message here, StdMeshMaterial loader
52  // will show one.
53  if (!surface->Read(Group, GetExtension(filename), C4SF_MipMap))
54  { delete surface; surface = nullptr; }
55  return surface;
56  }
bool AccessEntry(const char *szWildCard, size_t *iSize=nullptr, char *sFileName=nullptr, bool NeedsToBeAGroup=false)
Definition: C4Group.cpp:1695
const int C4SF_MipMap
Definition: C4Surface.h:52
char * GetExtension(char *szFilename)
Definition: StdFile.cpp:131
bool Read(CStdStream &hGroup, const char *extension, int iFlags)

Here is the call graph for this function:


The documentation for this class was generated from the following file: