Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/MaterialManager.cpp
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
historic_bruno: 2019 | |||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 12 Lines | |||||
#include "lib/ogl.h" | #include "lib/ogl.h" | ||||
#include "maths/MathUtil.h" | #include "maths/MathUtil.h" | ||||
#include "maths/Vector4D.h" | #include "maths/Vector4D.h" | ||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "ps/ConfigDB.h" | #include "ps/ConfigDB.h" | ||||
#include "ps/Filesystem.h" | #include "ps/Filesystem.h" | ||||
#include "ps/PreprocessorWrapper.h" | #include "ps/PreprocessorWrapper.h" | ||||
#include "ps/XML/Xeromyces.h" | #include "ps/XML/Xeromyces.h" | ||||
#include "renderer/Renderer.h" | #include "renderer/RenderingOptions.h" | ||||
#include <sstream> | #include <sstream> | ||||
CMaterialManager::CMaterialManager() | CMaterialManager::CMaterialManager() | ||||
{ | { | ||||
qualityLevel = 5.0; | qualityLevel = 5.0; | ||||
CFG_GET_VAL("materialmgr.quality", qualityLevel); | CFG_GET_VAL("materialmgr.quality", qualityLevel); | ||||
qualityLevel = clamp(qualityLevel, 0.0f, 10.0f); | qualityLevel = clamp(qualityLevel, 0.0f, 10.0f); | ||||
Show All 35 Lines | CMaterial CMaterialManager::LoadMaterial(const VfsPath& pathname) | ||||
AT(type); | AT(type); | ||||
AT(min); | AT(min); | ||||
AT(max); | AT(max); | ||||
AT(conf); | AT(conf); | ||||
#undef AT | #undef AT | ||||
#undef EL | #undef EL | ||||
CPreprocessorWrapper preprocessor; | CPreprocessorWrapper preprocessor; | ||||
preprocessor.AddDefine("CFG_FORCE_ALPHATEST", g_Renderer.m_Options.m_ForceAlphaTest ? "1" : "0"); | preprocessor.AddDefine("CFG_FORCE_ALPHATEST", g_RenderingOptions.GetForceAlphaTest() ? "1" : "0"); | ||||
CMaterial material; | CMaterial material; | ||||
material.AddStaticUniform("qualityLevel", CVector4D(qualityLevel, 0, 0, 0)); | material.AddStaticUniform("qualityLevel", CVector4D(qualityLevel, 0, 0, 0)); | ||||
XMBElement root = xeroFile.GetRoot(); | XMBElement root = xeroFile.GetRoot(); | ||||
XERO_ITER_EL(root, node) | XERO_ITER_EL(root, node) | ||||
{ | { | ||||
int token = node.GetNodeName(); | int token = node.GetNodeName(); | ||||
XMBAttributeList attrs = node.GetAttributes(); | XMBAttributeList attrs = node.GetAttributes(); | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
2019