mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-18 14:27:39 +03:00
0032862: Visualization, Graphic3d_TextureMap - add 3D texture definition
Image_PixMap has been extended to support definition of 3D bitmap (as an array of 2D slices). Graphic3d_TypeOfTexture enumeration values have been renamed to include full enum prefix. Added Graphic3d_TypeOfTexture_3D redirecting to GL_TEXTURE_3D. OpenGl_Texture::Init() has been extended to allow initialization of 3D texture. Graphic3d_Texture2Dmanual merged into Graphic3d_Texture2D and marked as deprecated alias. Graphic3d_TOT_2D_MIPMAP has been deprecated in favor of dedicated Graphic3d_TextureRoot::SetMipMaps(). Added Graphic3d_Texture3D class. vtexture - added argument -3d for uploading 3D texture.
This commit is contained in:
@@ -17,8 +17,6 @@ vinit v -w 512 -h 512
|
||||
vcamera -fovy 100
|
||||
if { [checkplatform -windows] && [vdriver -default] == "TKOpenGles" } {
|
||||
# Mipmaps cannot be generated for GL_SRGB8 texture format
|
||||
puts "TODO OCC30807 ALL: TKOpenGl | Type: Error"
|
||||
puts "TODO OCC30807 ALL: Unable to generate mipmap of cubemap"
|
||||
}
|
||||
|
||||
vbackground -cubemap $aCubeMap_posx $aCubeMap_negx $aCubeMap_posy $aCubeMap_negy $aCubeMap_posz $aCubeMap_negz
|
||||
|
60
tests/opengl/data/textures/texture_3d
Normal file
60
tests/opengl/data/textures/texture_3d
Normal file
@@ -0,0 +1,60 @@
|
||||
puts "========"
|
||||
puts "0032862: Visualization, Graphic3d_TextureMap - add 3D texture definition"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
set aTex1 [locate_data_file SF_CubeMap_posx.jpg]
|
||||
set aTex2 [locate_data_file SF_CubeMap_negx.jpg]
|
||||
set aTex3 [locate_data_file SF_CubeMap_posy.jpg]
|
||||
set aTex4 [locate_data_file SF_CubeMap_negy.jpg]
|
||||
set aTex5 [locate_data_file SF_CubeMap_posz.jpg]
|
||||
set aTex6 [locate_data_file SF_CubeMap_negz.jpg]
|
||||
|
||||
set aShaderVert "
|
||||
THE_SHADER_OUT vec3 TexCoord;
|
||||
uniform float uSlice;
|
||||
void main() {
|
||||
float aNbSlices = 6.0;
|
||||
TexCoord = occVertex.xyz;
|
||||
if (uSlice >= 0.0) { TexCoord = vec3(occTexCoord.xy, uSlice * 1.0 / aNbSlices + 0.5 / aNbSlices); }
|
||||
if (occTextureTrsf_Scale().y < 0.0) { TexCoord.y = 1.0 - TexCoord.y; }
|
||||
gl_Position = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * occVertex;
|
||||
}"
|
||||
|
||||
set aShaderFrag "
|
||||
#ifdef GL_ES
|
||||
uniform mediump sampler3D occSampler0;
|
||||
#else
|
||||
uniform sampler3D occSampler0;
|
||||
#endif
|
||||
THE_SHADER_IN vec3 TexCoord;
|
||||
void main() {
|
||||
occFragColor = occTexture3D(occSampler0, TexCoord);
|
||||
}"
|
||||
|
||||
set aGlslVer "#version 110"
|
||||
if { [vdriver -default] == "TKOpenGles" } { set aGlslVer "#version 300 es" }
|
||||
|
||||
# draw a box
|
||||
box b 1.0 1.0 1.0
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
vaxo
|
||||
vdisplay -dispMode 1 b
|
||||
vfit
|
||||
vrotate 0.2 0.0 0.0
|
||||
|
||||
# load 3D texture
|
||||
vtexture b -3d $aTex1 $aTex2 $aTex3 $aTex4 $aTex5 $aTex6
|
||||
|
||||
# texture slices
|
||||
foreach aSliceIter {0 1 2 3 4 5} {
|
||||
vshaderprog b -vert $aShaderVert -frag $aShaderFrag -defaultSampler 0 -uniform "uSlice" ${aSliceIter} -header "$aGlslVer"
|
||||
vdump $::imagedir/${::casename}_s${aSliceIter}.png
|
||||
}
|
||||
|
||||
# texture interpolation
|
||||
vshaderprog b -vert $aShaderVert -frag $aShaderFrag -defaultSampler 0 -uniform "uSlice" -1 -header "$aGlslVer"
|
||||
vdump $::imagedir/${::casename}_def.png
|
Reference in New Issue
Block a user