NAP
materialcommon.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 #include <vector>
8 #include "uniforminstance.h"
9 #include "bufferbindinginstance.h"
10 #include "shadervariabledeclarations.h"
11 #include "gpubuffer.h"
12 
13 namespace nap
14 {
18  enum class EBlendMode : int
19  {
20  NotSet = 0,
21  Opaque,
22  AlphaBlend,
23  Additive
24  };
25 
26 
30  enum class ECullWindingOrder : int
31  {
32  Clockwise = 0,
34  };
35 
36 
40  enum class EDepthMode : int
41  {
42  NotSet = 0,
44  ReadWrite,
45  ReadOnly,
46  WriteOnly,
48  };
49 
50 
54  enum class EDepthCompareMode : int
55  {
56  NotSet = 0,
57  Never,
58  Less,
59  Equal,
61  Greater,
62  NotEqual,
64  Always
65  };
66 
67 
72 
73 
81  {
82  public:
83  using UniformList = std::vector<const UniformLeafInstance*>;
84 
86  mDeclaration(&declaration)
87  {
88  assert(declaration.mDescriptorType == EDescriptorType::Uniform);
89  }
90 
93  };
94 
95 
103  {
104  public:
105  using BufferBindingList = std::vector<const BufferBindingInstance*>;
106 
108  mDeclaration(&declaration)
109  {
110  assert(declaration.mDescriptorType == EDescriptorType::Storage);
111  }
112 
115  };
116 }
nap::EDepthCompareMode::GreaterOrEqual
@ GreaterOrEqual
nap::EDepthCompareMode
EDepthCompareMode
Definition: materialcommon.h:54
nap::ECullWindingOrder::Clockwise
@ Clockwise
nap::uint
unsigned int uint
Definition: numeric.h:23
nap::ShaderConstantHash
uint ShaderConstantHash
Definition: materialcommon.h:71
nap::ECullWindingOrder::CounterClockwise
@ CounterClockwise
nap::ShaderStorageBufferObject::mBufferBinding
const BufferBindingInstance * mBufferBinding
Definition: materialcommon.h:114
nap::UniformBufferObject::mDeclaration
const BufferObjectDeclaration * mDeclaration
Definition: materialcommon.h:91
nap::EDepthMode::NoReadWrite
@ NoReadWrite
Neither read or write depth.
nap::EBlendMode
EBlendMode
Definition: materialcommon.h:18
nap::EDepthMode::InheritFromBlendMode
@ InheritFromBlendMode
Transparent objects do not write depth, but do read depth. Opaque objects read and write depth.
nap::EDepthMode
EDepthMode
Definition: materialcommon.h:40
nap::ECullWindingOrder
ECullWindingOrder
Definition: materialcommon.h:30
nap::EDepthCompareMode::NotSet
@ NotSet
nap::ShaderStorageBufferObject::ShaderStorageBufferObject
ShaderStorageBufferObject(const BufferObjectDeclaration &declaration)
Definition: materialcommon.h:107
nap::BufferBindingInstance
Definition: bufferbindinginstance.h:73
nap::EDepthMode::NotSet
@ NotSet
Default value for MaterialInstances, means that the Material's blend is used instead.
nap::EBlendMode::Opaque
@ Opaque
Regular opaque, similar to (One, Zero) blend.
nap::UniformBufferObject::UniformList
std::vector< const UniformLeafInstance * > UniformList
Definition: materialcommon.h:83
nap::EDepthCompareMode::Always
@ Always
nap::EBlendMode::NotSet
@ NotSet
Default value for MaterialInstances, means that the Material's blend mode is used instead.
nap::UniformBufferObject::mUniforms
UniformList mUniforms
Definition: materialcommon.h:92
nap::EDepthCompareMode::Greater
@ Greater
nap::EDepthCompareMode::Equal
@ Equal
nap::EDepthCompareMode::Never
@ Never
nap::ShaderVariableStructDeclaration::mDescriptorType
EDescriptorType mDescriptorType
The type of descriptor for this resource.
Definition: shadervariabledeclarations.h:112
nap::ShaderStorageBufferObject::BufferBindingList
std::vector< const BufferBindingInstance * > BufferBindingList
Definition: materialcommon.h:105
nap::EDepthMode::ReadOnly
@ ReadOnly
Only read depth.
nap::EDepthMode::WriteOnly
@ WriteOnly
Only write depth.
nap::ShaderStorageBufferObject::mDeclaration
const BufferObjectDeclaration * mDeclaration
Definition: materialcommon.h:113
nap::EDescriptorType::Uniform
@ Uniform
Specifies a uniform buffer descriptor. device readonly.
nap::UniformBufferObject
Definition: materialcommon.h:80
nap::EBlendMode::Additive
@ Additive
Additive, (One, One) blend.
nap
Definition: templateapp.h:17
nap::EDepthMode::ReadWrite
@ ReadWrite
Read and write depth.
nap::EBlendMode::AlphaBlend
@ AlphaBlend
Transparent object (SrcAlpha, InvSrcAlpha) blend.
nap::BufferObjectDeclaration
Definition: shadervariabledeclarations.h:171
nap::EDescriptorType::Storage
@ Storage
Specifies a storage buffer descriptor. device read/write.
nap::EDepthCompareMode::LessOrEqual
@ LessOrEqual
nap::EDepthCompareMode::Less
@ Less
nap::ShaderStorageBufferObject
Definition: materialcommon.h:102
nap::UniformBufferObject::UniformBufferObject
UniformBufferObject(const BufferObjectDeclaration &declaration)
Definition: materialcommon.h:85
nap::EDepthCompareMode::NotEqual
@ NotEqual