1#ifndef RAYLIB_CPP_INCLUDE_MATERIAL_HPP_
2#define RAYLIB_CPP_INCLUDE_MATERIAL_HPP_
8#include "./raylib-cpp-utils.hpp"
24 set(LoadMaterialDefault());
43 static std::vector<Material>
Load(
const std::string& fileName) {
46 ::Material* materials = ::LoadMaterials(fileName.c_str(), &count);
47 return std::vector<Material>(materials, materials + count);
50 GETTERSETTER(::Shader,
Shader, shader)
51 GETTERSETTER(::MaterialMap*, Maps, maps)
80 if (maps !=
nullptr) {
81 ::UnloadMaterial(*
this);
90 ::SetMaterialTexture(
this, mapType, texture);
105 inline const Material&
DrawMesh(const ::Mesh& mesh, ::Matrix* transforms,
int instances)
const {
106 ::DrawMeshInstanced(mesh, *
this, transforms, instances);
111 inline void set(const ::Material& material) {
112 shader = material.shader;
113 maps = material.maps;
114 params[0] = material.params[0];
115 params[1] = material.params[1];
116 params[2] = material.params[2];
117 params[3] = material.params[3];
static std::vector< Material > Load(const std::string &fileName)
Load materials from model file.
const Material & DrawMesh(const ::Mesh &mesh, ::Matrix *transforms, int instances) const
Draw multiple mesh instances with material and different transforms.
Material & SetTexture(int mapType, const ::Texture2D &texture)
Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)
void Unload()
Unload material from memory.
Material(const Material &)=delete
Material()
Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
const Material & DrawMesh(const ::Mesh &mesh, ::Matrix transform) const
Draw a 3d mesh with material and transform.
Material(const ::Material &material)
Material & operator=(Material &&other) noexcept
Material & operator=(const Material &)=delete
Material(Material &&other)
All raylib-cpp classes and functions appear in the raylib namespace.