MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / setDiffuseTextureFromData

Method setDiffuseTextureFromData

examples/TinyRenderer/model.cpp:67–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void Model::setDiffuseTextureFromData(unsigned char *textureImage, int textureWidth, int textureHeight)
68{
69 {
70 B3_PROFILE("new TGAImage");
71 diffusemap_ = TGAImage(textureWidth, textureHeight, TGAImage::RGB);
72 }
73 TGAColor color;
74 color.bgra[3] = 255;
75
76 color.bytespp = 3;
77 {
78 B3_PROFILE("copy texels");
79 memcpy(diffusemap_.buffer(), textureImage, textureHeight * textureWidth * 3);
80 }
81 {
82 B3_PROFILE("flip_vertically");
83 diffusemap_.flip_vertically();
84 }
85}
86
87void Model::loadDiffuseTexture(const char *relativeFileName)
88{

Callers 2

registerMeshShapeMethod · 0.80
changeShapeTextureMethod · 0.80

Calls 3

TGAImageClass · 0.85
bufferMethod · 0.80
flip_verticallyMethod · 0.80

Tested by

no test coverage detected