35 lines
747 B
Go
35 lines
747 B
Go
package manager
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
|
|
"git.influ.su/artmares/art3de/pkg/render/material"
|
|
)
|
|
|
|
type materialManager struct {
|
|
materials map[string]material.Material
|
|
textureCache *textureCache
|
|
boundShader uint32
|
|
mu sync.RWMutex
|
|
stats Stats
|
|
}
|
|
|
|
// New создает новый менеджер материалов
|
|
func New() Manager {
|
|
return &materialManager{
|
|
materials: make(map[string]material.Material),
|
|
textureCache: newTextureCache(),
|
|
}
|
|
}
|
|
|
|
func (m *materialManager) CreatePBRMaterial(name string, shader uint32, config *PBRConfig) (material.Material, error) {
|
|
m.mu.Lock()
|
|
defer m.mu.Unlock()
|
|
|
|
if _, exists := m.materials[name]; exists {
|
|
return nil, fmt.Errorf("material %s already exists", name)
|
|
}
|
|
|
|
}
|