MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / addTextureToModel

Function addTextureToModel

CesiumGltf/test/TestPropertyTextureView.cpp:38–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37namespace {
38void addTextureToModel(
39 Model& model,
40 int32_t wrapS,
41 int32_t wrapT,
42 int32_t width,
43 int32_t height,
44 int32_t channels,
45 const std::vector<uint8_t>& data) {
46 Image& image = model.images.emplace_back();
47 image.pAsset.emplace();
48 image.pAsset->width = width;
49 image.pAsset->height = height;
50 image.pAsset->channels = channels;
51 image.pAsset->bytesPerChannel = 1;
52
53 std::vector<std::byte>& imageData = image.pAsset->pixelData;
54 imageData.resize(data.size());
55 std::memcpy(imageData.data(), data.data(), data.size());
56
57 Sampler& sampler = model.samplers.emplace_back();
58 sampler.wrapS = wrapS;
59 sampler.wrapT = wrapT;
60
61 Texture& texture = model.textures.emplace_back();
62 texture.sampler = static_cast<int32_t>(model.samplers.size() - 1);
63 texture.source = static_cast<int32_t>(model.images.size() - 1);
64}
65
66template <typename T, bool Normalized>
67void verifyTextureTransformConstruction(

Callers 1

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected