Mercurial > games > semicongine
annotate semiconginev2/old/material.nim @ 1218:56781cc0fc7c compiletime-tests
did: renamge main package
author | sam <sam@basx.dev> |
---|---|
date | Wed, 17 Jul 2024 21:01:37 +0700 |
parents | semicongine/old/material.nim@a3eb305bcac2 |
children |
rev | line source |
---|---|
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
1 import std/tables |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
2 import std/strformat |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
3 import std/strutils |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
4 |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
5 import ./core |
897
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
6 import ./vulkan/shader |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
7 |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
8 type |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
9 MaterialType* = object |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
10 name*: string |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
11 vertexAttributes*: Table[string, DataType] |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
12 instanceAttributes*: Table[string, DataType] |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
13 attributes*: Table[string, DataType] |
890 | 14 MaterialData* = ref object # needs to be ref, so we can update stuff from other locations |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
15 theType*: MaterialType |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
16 name*: string |
867 | 17 attributes: Table[string, DataList] |
870
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
18 dirtyAttributes: seq[string] |
867 | 19 |
1138 | 20 proc HasMatchingAttribute*(materialType: MaterialType, attr: ShaderAttribute): bool = |
867 | 21 return materialType.attributes.contains(attr.name) and materialType.attributes[attr.name] == attr.theType |
22 | |
1138 | 23 proc HasMatchingAttribute*(material: MaterialData, attr: ShaderAttribute): bool = |
867 | 24 return material.attributes.contains(attr.name) and material.attributes[attr.name].theType == attr.theType |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
25 |
869
65afec4cb6c6
did: overhaul dynamic array-api in a few places
Sam <sam@basx.dev>
parents:
868
diff
changeset
|
26 template `[]`*(material: MaterialData, attributeName: string): DataList = |
867 | 27 material.attributes[attributeName] |
869
65afec4cb6c6
did: overhaul dynamic array-api in a few places
Sam <sam@basx.dev>
parents:
868
diff
changeset
|
28 template `[]`*(material: MaterialData, attributeName: string, t: typedesc): ref seq[t] = |
65afec4cb6c6
did: overhaul dynamic array-api in a few places
Sam <sam@basx.dev>
parents:
868
diff
changeset
|
29 material.attributes[attributeName][t] |
65afec4cb6c6
did: overhaul dynamic array-api in a few places
Sam <sam@basx.dev>
parents:
868
diff
changeset
|
30 template `[]`*(material: MaterialData, attributeName: string, i: int, t: typedesc): untyped = |
65afec4cb6c6
did: overhaul dynamic array-api in a few places
Sam <sam@basx.dev>
parents:
868
diff
changeset
|
31 material.attributes[attributeName][i, t] |
868
252cbc10b25f
did: improve/refactor some of the material API
Sam <sam@basx.dev>
parents:
867
diff
changeset
|
32 |
870
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
33 template `[]=`*(material: var MaterialData, attribute: string, newList: DataList) = |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
34 material.attributes[attribute] = newList |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
35 if not material.dirtyAttributes.contains(attribute): |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
36 material.dirtyAttributes.add attribute |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
37 template `[]=`*[T](material: var MaterialData, attribute: string, newList: seq[T]) = |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
38 material.attributes[attribute][] = newList |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
39 if not material.dirtyAttributes.contains(attribute): |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
40 material.dirtyAttributes.add attribute |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
41 template `[]=`*[T](material: var MaterialData, attribute: string, i: int, newValue: T) = |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
42 material.attributes[attribute][i] = newValue |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
43 if not material.dirtyAttributes.contains(attribute): |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
44 material.dirtyAttributes.add attribute |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
45 |
1138 | 46 func DirtyAttributes*(material: MaterialData): seq[string] = |
870
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
47 material.dirtyAttributes |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
48 |
1138 | 49 proc ClearDirtyAttributes*(material: var MaterialData) = |
870
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
50 material.dirtyAttributes.reset |
b975eab2b694
did: improve dynamic array, mesh and material APIs a ton, changes in material attributes are now detected and will trigger uniform-updates
Sam <sam@basx.dev>
parents:
869
diff
changeset
|
51 |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
52 proc `$`*(materialType: MaterialType): string = |
998
7e89c8fe57a8
did: add name for material types and fix shader-materialtype-compatability check
sam <sam@basx.dev>
parents:
920
diff
changeset
|
53 return materialType.name |
7e89c8fe57a8
did: add name for material types and fix shader-materialtype-compatability check
sam <sam@basx.dev>
parents:
920
diff
changeset
|
54 |
1138 | 55 proc AssertCanRender*(shader: ShaderConfiguration, materialType: MaterialType) = |
998
7e89c8fe57a8
did: add name for material types and fix shader-materialtype-compatability check
sam <sam@basx.dev>
parents:
920
diff
changeset
|
56 for attr in shader.inputs: |
7e89c8fe57a8
did: add name for material types and fix shader-materialtype-compatability check
sam <sam@basx.dev>
parents:
920
diff
changeset
|
57 if attr.perInstance: |
1008
443e8090614c
fix: some mesh attributes will be handled automatically, ignore them when doing mesh-material-shader compatability-check
sam <sam@basx.dev>
parents:
1001
diff
changeset
|
58 if attr.name in [TRANSFORM_ATTRIB, MATERIALINDEX_ATTRIBUTE]: |
443e8090614c
fix: some mesh attributes will be handled automatically, ignore them when doing mesh-material-shader compatability-check
sam <sam@basx.dev>
parents:
1001
diff
changeset
|
59 continue |
999
b5be4ea07c3c
fix: errors that have now been discovered thanks to last commit :)
sam <sam@basx.dev>
parents:
998
diff
changeset
|
60 assert materialType.instanceAttributes.contains(attr.name), &"MaterialType '{materialType}' requires instance attribute '{attr.name}' in order to be renderable with the assigned shader '{shader}'" |
1000 | 61 assert materialType.instanceAttributes[attr.name] == attr.theType, &"Instance attribute '{attr.name}' of MaterialType '{materialType}' is of type {materialType.instanceAttributes[attr.name]} but assigned shader '{shader}' declares type '{attr.theType}'" |
998
7e89c8fe57a8
did: add name for material types and fix shader-materialtype-compatability check
sam <sam@basx.dev>
parents:
920
diff
changeset
|
62 else: |
999
b5be4ea07c3c
fix: errors that have now been discovered thanks to last commit :)
sam <sam@basx.dev>
parents:
998
diff
changeset
|
63 assert materialType.vertexAttributes.contains(attr.name), &"MaterialType '{materialType}' requires vertex attribute '{attr.name}' in order to be renderable with the assigned shader '{shader}'" |
1000 | 64 assert materialType.vertexAttributes[attr.name] == attr.theType, &"Vertex attribute '{attr.name}' of MaterialType '{materialType}' is of type {materialType.vertexAttributes[attr.name]} but assigned shader '{shader}' declares type '{attr.theType}'" |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
65 |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
66 proc `$`*(material: MaterialData): string = |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
67 var attributes: seq[string] |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
68 for key, value in material.attributes.pairs: |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
69 attributes.add &"{key}: {value}" |
999
b5be4ea07c3c
fix: errors that have now been discovered thanks to last commit :)
sam <sam@basx.dev>
parents:
998
diff
changeset
|
70 return &"""{material.name}: [{attributes.join(", ")}]""" |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
71 |
1139
114f395b9144
did: finish refactoring and updated all tests accordingly
sam <sam@basx.dev>
parents:
1138
diff
changeset
|
72 proc InitMaterialData*( |
868
252cbc10b25f
did: improve/refactor some of the material API
Sam <sam@basx.dev>
parents:
867
diff
changeset
|
73 theType: MaterialType, |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
74 name: string, |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
75 attributes: Table[string, DataList], |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
76 ): MaterialData = |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
77 var theName = name |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
78 if theName == "": |
868
252cbc10b25f
did: improve/refactor some of the material API
Sam <sam@basx.dev>
parents:
867
diff
changeset
|
79 theName = &"material instance of '{theType}'" |
252cbc10b25f
did: improve/refactor some of the material API
Sam <sam@basx.dev>
parents:
867
diff
changeset
|
80 for matName, theType in theType.attributes.pairs: |
252cbc10b25f
did: improve/refactor some of the material API
Sam <sam@basx.dev>
parents:
867
diff
changeset
|
81 assert attributes.contains(matName), &"missing material attribute '{matName}' for {theType}" |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
82 assert attributes[matName].theType == theType |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
83 MaterialData( |
868
252cbc10b25f
did: improve/refactor some of the material API
Sam <sam@basx.dev>
parents:
867
diff
changeset
|
84 theType: theType, |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
85 name: theName, |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
86 attributes: attributes, |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
87 ) |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
88 |
1139
114f395b9144
did: finish refactoring and updated all tests accordingly
sam <sam@basx.dev>
parents:
1138
diff
changeset
|
89 proc InitMaterialData*( |
868
252cbc10b25f
did: improve/refactor some of the material API
Sam <sam@basx.dev>
parents:
867
diff
changeset
|
90 theType: MaterialType, |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
91 name: string = "", |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
92 attributes: openArray[(string, DataList)] = @[], |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
93 ): MaterialData = |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
94 var theName = name |
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
95 if theName == "": |
868
252cbc10b25f
did: improve/refactor some of the material API
Sam <sam@basx.dev>
parents:
867
diff
changeset
|
96 theName = &"material instance of '{theType}'" |
1139
114f395b9144
did: finish refactoring and updated all tests accordingly
sam <sam@basx.dev>
parents:
1138
diff
changeset
|
97 InitMaterialData(theType = theType, name = theName, attributes = attributes.toTable) |
840
44ec744fbedc
did: package restructuring according to nimble recommendation for libraries
Sam <sam@basx.dev>
parents:
diff
changeset
|
98 |
897
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
99 const |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
100 VERTEX_COLORED_MATERIAL* = MaterialType( |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
101 name: "vertex color material", |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
102 vertexAttributes: { |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
103 "position": Vec3F32, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
104 "color": Vec4F32, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
105 }.toTable, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
106 ) |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
107 SINGLE_COLOR_MATERIAL* = MaterialType( |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
108 name: "single color material", |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
109 vertexAttributes: { |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
110 "position": Vec3F32, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
111 }.toTable, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
112 attributes: {"color": Vec4F32}.toTable |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
113 ) |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
114 SINGLE_TEXTURE_MATERIAL* = MaterialType( |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
115 name: "single texture material", |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
116 vertexAttributes: { |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
117 "position": Vec3F32, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
118 "uv": Vec2F32, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
119 }.toTable, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
120 attributes: {"baseTexture": TextureType}.toTable |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
121 ) |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
122 COLORED_SINGLE_TEXTURE_MATERIAL* = MaterialType( |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
123 name: "colored single texture material", |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
124 vertexAttributes: { |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
125 "position": Vec3F32, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
126 "uv": Vec2F32, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
127 }.toTable, |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
128 attributes: {"baseTexture": TextureType, "color": Vec4F32}.toTable |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
129 ) |
999
b5be4ea07c3c
fix: errors that have now been discovered thanks to last commit :)
sam <sam@basx.dev>
parents:
998
diff
changeset
|
130 EMPTY_MATERIAL* = MaterialType( |
b5be4ea07c3c
fix: errors that have now been discovered thanks to last commit :)
sam <sam@basx.dev>
parents:
998
diff
changeset
|
131 name: "empty material", |
b5be4ea07c3c
fix: errors that have now been discovered thanks to last commit :)
sam <sam@basx.dev>
parents:
998
diff
changeset
|
132 vertexAttributes: {"position": Vec3F32}.toTable, |
b5be4ea07c3c
fix: errors that have now been discovered thanks to last commit :)
sam <sam@basx.dev>
parents:
998
diff
changeset
|
133 instanceAttributes: {TRANSFORM_ATTRIB: Mat4F32}.toTable, |
b5be4ea07c3c
fix: errors that have now been discovered thanks to last commit :)
sam <sam@basx.dev>
parents:
998
diff
changeset
|
134 ) |
1138 | 135 EMPTY_SHADER* = CreateShaderConfiguration( |
998
7e89c8fe57a8
did: add name for material types and fix shader-materialtype-compatability check
sam <sam@basx.dev>
parents:
920
diff
changeset
|
136 name = "empty shader", |
897
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
137 inputs = [ |
1137 | 138 Attr[Mat4](TRANSFORM_ATTRIB, memoryPerformanceHint = PreferFastWrite, perInstance = true), |
139 Attr[Vec3f]("position", memoryPerformanceHint = PreferFastRead), | |
897
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
140 ], |
1137 | 141 outputs = [Attr[Vec4f]("color")], |
897
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
142 vertexCode = &"gl_Position = vec4(position, 1.0) * {TRANSFORM_ATTRIB};", |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
143 fragmentCode = &"color = vec4(1, 0, 1, 1);" |
fa54a8a1e3e4
fix: text-alignment, a few smaller fixes
Sam <sam@basx.dev>
parents:
890
diff
changeset
|
144 ) |