TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ LoadFace()

bool TextureCubemap::LoadFace ( std::string  path,
int  face 
)

Definition at line 75 of file TextureCubemap.cpp.

76{
77 bool res = true;
78 int width, height, nrChannels;
79 unsigned char *data = stbi_load(path.c_str(), &width, &height, &nrChannels, 3);
80 facesSizes[face] = IVec2(width, height);
81
82 if (data)
83 {
84 std::cout << "Loaded : " << path << "\n";
85
86 if(facesData[face])
87 {
88 stbi_image_free(facesData[face]);
89 }
90
91 facesData[face] = data;
92 res = true;
93 }
94
95 else
96 {
97 res = false;
98 std::cout << "Failed to load : " << path << std::endl;
99 stbi_image_free(data);
100 }
101
102 faces[face] = path;
103 return res;
104}
Definition: BaseMath.h:4