Line data Source code
1 : /* Copyright (C) 2023 Wildfire Games.
2 : * This file is part of 0 A.D.
3 : *
4 : * 0 A.D. is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 2 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * 0 A.D. is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 : */
17 :
18 : #include "precompiled.h"
19 :
20 : #include "Material.h"
21 : #include "ps/CStrInternStatic.h"
22 :
23 0 : CMaterial::CMaterial() :
24 0 : m_AlphaBlending(false)
25 : {
26 0 : }
27 :
28 0 : void CMaterial::SetShaderEffect(const CStr& effect)
29 : {
30 0 : m_ShaderEffect = CStrIntern(effect);
31 0 : }
32 :
33 0 : void CMaterial::AddShaderDefine(CStrIntern key, CStrIntern value)
34 : {
35 0 : m_ShaderDefines.Add(key, value);
36 0 : }
37 :
38 0 : void CMaterial::AddStaticUniform(const char* key, const CVector4D& value)
39 : {
40 0 : m_StaticUniforms.Add(key, value);
41 0 : }
42 :
43 0 : void CMaterial::AddSampler(const TextureSampler& texture)
44 : {
45 0 : m_Samplers.push_back(texture);
46 0 : if (texture.Name == str_baseTex)
47 0 : m_DiffuseTexture = texture.Sampler;
48 0 : }
49 :
50 0 : void CMaterial::AddRenderQuery(const char* key)
51 : {
52 0 : m_RenderQueries.Add(key);
53 0 : }
54 :
55 0 : void CMaterial::AddRequiredSampler(const CStr& samplerName)
56 : {
57 0 : CStrIntern string(samplerName);
58 0 : m_RequiredSamplers.push_back(string);
59 3 : }
|