Path Tracing
Loading...
Searching...
No Matches
texture.hpp File Reference

Uploads CPU-decoded texture arrays. Has no knowledge of ASSIMP or the format of the model's source file - that's on mesh.hpp. More...

#include <string>
#include <vector>
#include "config.hpp"
#include "mesh.hpp"
Include dependency graph for texture.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool loadEnvMap (const std::string &path, Renderer &r)
 Loads an HDRI map and uploads it as a GPU texture.
bool uploadTexture (const vector< CPUMaterial > &cpu_materials, vector< GPUMaterial > &gpu_materials, Renderer &r)
 Builds the material texture array from the loaded materials. Uploads every material texture into a GPU texture array, and patches each GPUMaterial::tex_index to point at its layer.

Detailed Description

Uploads CPU-decoded texture arrays. Has no knowledge of ASSIMP or the format of the model's source file - that's on mesh.hpp.

Author
Leonel Matos
Note
Using nvtop to profile program VRAM/GPU usage
Date
2026-07-02

Function Documentation

◆ loadEnvMap()

bool loadEnvMap ( const std::string & path,
Renderer & r )

Loads an HDRI map and uploads it as a GPU texture.

Parameters
pathPath to the HDRI file (.hdr, .exr)
rRenderer to pass env map
Returns
true if the image was loaded

◆ uploadTexture()

bool uploadTexture ( const vector< CPUMaterial > & cpu_materials,
vector< GPUMaterial > & gpu_materials,
Renderer & r )

Builds the material texture array from the loaded materials. Uploads every material texture into a GPU texture array, and patches each GPUMaterial::tex_index to point at its layer.

Todo
Bad handling textures that are not squared (like 128x2048, or 64x512), but forces to be. It's hip to be square
Parameters
cpu_materialsCPU-sided material data, with texture sources
gpu_materialsIn-out GPU material
rendererRenderer to pass the resulting array
Returns
true on success
See also
CPUMaterial, GPUMaterials