Material: Make scene optional, fix typo, other minor changes.
This commit is contained in:
parent
fb50b3a018
commit
0b5cd6f8d2
1 changed files with 12 additions and 12 deletions
|
@ -40,7 +40,7 @@ when defined(nimdoc):
|
|||
|
||||
# Forward declarations
|
||||
func add_line_numbers(s: string, first: int=1):string
|
||||
proc newMaterial*(engine: MyouEngine, name: string, scene: Scene,
|
||||
proc newMaterial*(engine: MyouEngine, name: string, scene: Scene = nil,
|
||||
vertex = "",
|
||||
fragment = "",
|
||||
textures = initOrderedTable[string, Texture](),
|
||||
|
@ -122,7 +122,7 @@ func add_line_numbers(s: string, first: int=1):string =
|
|||
lines[i] = $(i+first) & " " & line
|
||||
return lines.join("\n")
|
||||
|
||||
proc newMaterial*(engine: MyouEngine, name: string, scene: Scene,
|
||||
proc newMaterial*(engine: MyouEngine, name: string, scene: Scene = nil,
|
||||
vertex = "",
|
||||
fragment = "",
|
||||
textures = initOrderedTable[string, Texture](),
|
||||
|
@ -166,7 +166,7 @@ proc newSolidMaterial*(engine: MyouEngine, name: string, color: Vec4): Material
|
|||
}}""",
|
||||
)
|
||||
|
||||
proc newVertexColordMaterial*(engine: MyouEngine, name: string): Material =
|
||||
proc newVertexColorMaterial*(engine: MyouEngine, name = "vertex color"): Material =
|
||||
newMaterial(engine, name, nil,
|
||||
fragment = dedent """
|
||||
in vec4 vcol;
|
||||
|
@ -502,6 +502,8 @@ proc initShader*(self: Shader, engine: MyouEngine, material: Material,
|
|||
|
||||
# TODO: use KHR_parallel_shader_compile
|
||||
|
||||
# TODO: identify unused uniforms (at least unused textures)
|
||||
|
||||
var ubo_names = newSeqOfCap[string](material.ubos.len)
|
||||
self.ubos.setLen 0
|
||||
for ubo in material.ubos & modifier_ubos:
|
||||
|
@ -551,5 +553,3 @@ proc use*(self: Shader): GLuint {.inline,discardable.} =
|
|||
|
||||
proc destroy*(self: Shader) =
|
||||
self.program = 0.GPUProgram
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue