art3de/pkg/render/material/interface.go
2026-02-11 18:56:49 +03:00

56 lines
2.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package material
// Material - интерфейс материала
type Material interface {
// ID возвращает уникальный идентификатор материала
ID() uint32
// Name возвращает имя материала
Name() string
// Type возвращает тип материала
Type() Type
// Shader возвращает шейдерную программу
Shader() uint32
// Apply применяет материал для рендеринга
Apply(instance Instance)
// Update обновляет состояние материала (для анимированных)
Update(deltaTime float32)
// CreateInstace создает экземпляр материала
CreateInstance() Instance
// Destroy освобождает ресурсы материала
Destroy()
}
// Instance - экземпляр материала с переопределенными параметрами
type Instance interface {
// Material возвращает базовый материал
Material() Material
// SetParameter устанавливает параметр
SetParameter(name string, value any) error
// GetParameter возвращает параметер
GetParameter(name string) (any, error)
// SetTexture переопределяет текстуру
SetTexture(textureType TextureType, texture Texture) error
// GetTexture возвращает текстуру
GetTexture(textureType TextureType) Texture
// Clone создает копию экземпляра
Clone() Instance
}
// Texture - интерфейс текстуры
type Texture interface {
// ID возвращает OpenGL ID текстуры
ID() uint32
// Type возвращает тип текстуры
Type() TextureType
// Path возвращает путь к файлу
Path() string
// Width возвращает ширину
Width() int
// Height возвращает высоту
Height() int
// Format возвращает формат
Format() uint32
// Destroy освобождает ресурсы
Destroy()
}