zworld/engine/renderapi/material/instance.go
2024-01-14 22:56:06 +08:00

21 lines
503 B
Go

package material
import (
"zworld/engine/renderapi/command"
"zworld/engine/renderapi/descriptor"
)
type Instance[D descriptor.Set] struct {
material *Material[D]
set D
}
func (i *Instance[D]) Material() *Material[D] { return i.material }
func (i *Instance[D]) Descriptors() D { return i.set }
func (s *Instance[D]) Bind(cmd command.Buffer) {
// might want to move this to the command buffer instead to avoid the import
s.material.Bind(cmd)
cmd.CmdBindGraphicsDescriptor(s.set)
}