1 #ifndef RAYLIB_CPP_INCLUDE_MATERIAL_HPP_
2 #define RAYLIB_CPP_INCLUDE_MATERIAL_HPP_
7 #include "./raylib.hpp"
8 #include "./raylib-cpp-utils.hpp"
16 Material(const ::Material& material) {
24 set(LoadMaterialDefault());
34 other.params[0] = 0.0f;
35 other.params[1] = 0.0f;
36 other.params[2] = 0.0f;
37 other.params[3] = 0.0f;
47 static std::vector<Material>
Load(
const std::string& fileName) {
50 ::Material* materials = ::LoadMaterials(fileName.c_str(), &count);
51 return std::vector<Material>(materials, materials + count);
55 GETTERSETTER(::MaterialMap*, Maps, maps)
84 if (maps !=
nullptr) {
85 ::UnloadMaterial(*
this);
94 ::SetMaterialTexture(
this, mapType, texture);
108 inline void DrawMesh(const ::Mesh& mesh, ::
Matrix* transforms,
int instances)
const {
109 ::DrawMeshInstanced(mesh, *
this, transforms, instances);
113 void set(const ::Material& material) {
114 shader = material.shader;
115 maps = material.maps;
116 params[0] = material.params[0];
117 params[1] = material.params[1];
118 params[2] = material.params[2];
119 params[3] = material.params[3];
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()
Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)
void DrawMesh(const ::Mesh &mesh, ::Matrix *transforms, int instances) const
Draw multiple mesh instances with material and different transforms.
void DrawMesh(const ::Mesh &mesh, ::Matrix transform) const
Draw a 3d mesh with material and transform.
static std::vector< Material > Load(const std::string &fileName)
Load materials from model file.
Matrix type (OpenGL style 4x4 - right handed, column major)
All raylib-cpp classes and functions appear in the raylib namespace.