MCPcopy Create free account
hub / github.com/Kitware/VTK / GetVTKTexture

Method GetVTKTexture

IO/Geometry/vtkGLTFTexture.cxx:16–62  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

14
15//------------------------------------------------------------------------------
16vtkSmartPointer<vtkTexture> vtkGLTFTexture::GetVTKTexture()
17{
18 vtkNew<vtkTexture> texture;
19 texture->SetColorModeToDirectScalars();
20 texture->SetBlendingMode(vtkTexture::VTK_TEXTURE_BLENDING_MODE_MODULATE);
21 // Approximate filtering settings
22 if (this->Sampler.MinFilter == vtkGLTFDocumentLoader::Sampler::FilterType::NEAREST ||
23 this->Sampler.MinFilter == vtkGLTFDocumentLoader::Sampler::FilterType::LINEAR)
24 {
25 texture->MipmapOff();
26 }
27 else
28 {
29 texture->MipmapOn();
30 }
31
32 if (this->Sampler.WrapS == vtkGLTFDocumentLoader::Sampler::WrapType::CLAMP_TO_EDGE ||
33 this->Sampler.WrapT == vtkGLTFDocumentLoader::Sampler::WrapType::CLAMP_TO_EDGE)
34 {
35 texture->RepeatOff();
36 texture->EdgeClampOn();
37 }
38 else if (this->Sampler.WrapS == vtkGLTFDocumentLoader::Sampler::WrapType::REPEAT ||
39 this->Sampler.WrapT == vtkGLTFDocumentLoader::Sampler::WrapType::REPEAT)
40 {
41 texture->RepeatOn();
42 texture->EdgeClampOff();
43 }
44 else
45 {
46 vtkWarningWithObjectMacro(nullptr, "Mirrored texture wrapping is not supported!");
47 }
48
49 if (this->Sampler.MinFilter == vtkGLTFDocumentLoader::Sampler::FilterType::LINEAR ||
50 this->Sampler.MinFilter == vtkGLTFDocumentLoader::Sampler::FilterType::LINEAR_MIPMAP_NEAREST ||
51 this->Sampler.MinFilter == vtkGLTFDocumentLoader::Sampler::FilterType::NEAREST_MIPMAP_LINEAR ||
52 this->Sampler.MinFilter == vtkGLTFDocumentLoader::Sampler::FilterType::LINEAR_MIPMAP_LINEAR ||
53 this->Sampler.MagFilter == vtkGLTFDocumentLoader::Sampler::FilterType::LINEAR ||
54 this->Sampler.MagFilter == vtkGLTFDocumentLoader::Sampler::FilterType::LINEAR_MIPMAP_NEAREST ||
55 this->Sampler.MagFilter == vtkGLTFDocumentLoader::Sampler::FilterType::NEAREST_MIPMAP_LINEAR ||
56 this->Sampler.MagFilter == vtkGLTFDocumentLoader::Sampler::FilterType::LINEAR_MIPMAP_LINEAR)
57 {
58 texture->InterpolateOn();
59 }
60 texture->SetInputData(this->Image);
61 return texture;
62}
63
64//------------------------------------------------------------------------------
65void vtkGLTFTexture::PrintSelf(ostream& os, vtkIndent indent)

Callers 2

AddActorsFunction · 0.80
AddActorsFunction · 0.80

Calls 2

SetInputDataMethod · 0.45

Tested by 2

AddActorsFunction · 0.64
AddActorsFunction · 0.64