1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0028912: Visualization, TKOpenGl - multi-texture support

Graphic3d_AspectFillArea3d now stores array of textures.
Graphic3d_TextureParams stores texture unit for mapping texture.

OpenGl_Context::BindTextures() - context now manages the set of active textures.
Related code has been removed from OpenGl_Workspace.

OpenGl_Sampler has been extended to hold texture parameters structure.
OpenGl_Texture now holds OpenGl_Sampler instance as class field.
OpenGl_Texture inherits new class OpenGl_NamedResource and holds
texture identifier used for sharing resource in OpenGl_Context.

OpenGl_RaytraceGeometry now creates bindless textures taking
Sampler object directly from OpenGl_Texture.
OpenGl_Context::BindTextures() automatically recreates immutable
Sampler Object on texture parameters change.

Declared new structure OpenGl_ArbSamplerObject for platform-neutral
usage of related functionality.
Related functions are now loaded within OpenGL ES 3.0+.

Declarations.glsl - occActiveSampler has been renamed to occSampler0
with aliases occSamplerBaseColor (main) and occActiveSampler (for compatibility).
Additional texture samplers should be declared explicitly
within specific GLSL program as occSampler1, occSampler2, etc.

AIS_Shape and AIS_ColoredShape now computes Shaded presentation
with UV coordinates if texture mapping is enabled in Drawer.

vshaderprog now accepts Shader source code as parameter.
This commit is contained in:
kgv
2017-07-10 15:43:25 +03:00
committed by bugmaster
parent a6dee93dfa
commit cc8cbabe5c
59 changed files with 2095 additions and 1272 deletions

View File

@@ -118,10 +118,13 @@ vec4 occBackMaterial_Specular(void); //!< Specular reflection
float occBackMaterial_Shininess(void); //!< Specular exponent
float occBackMaterial_Transparency(void); //!< Transparency coefficient
#define occActiveSampler occSampler0 //!< alias for backward compatibility
#define occSamplerBaseColor occSampler0 //!< alias to a base color texture
uniform sampler2D occSampler0; //!< current active sampler;
//! occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing
uniform vec4 occColor; //!< color value (in case of disabled lighting)
uniform THE_PREC_ENUM int occDistinguishingMode; //!< Are front and back faces distinguished?
uniform THE_PREC_ENUM int occTextureEnable; //!< Is texture enabled?
uniform sampler2D occActiveSampler; //!< Current active sampler
uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters
uniform float occPointSize; //!< point size

View File

@@ -121,10 +121,13 @@ static const char Shaders_Declarations_glsl[] =
"float occBackMaterial_Shininess(void); //!< Specular exponent\n"
"float occBackMaterial_Transparency(void); //!< Transparency coefficient\n"
"\n"
"#define occActiveSampler occSampler0 //!< alias for backward compatibility\n"
"#define occSamplerBaseColor occSampler0 //!< alias to a base color texture\n"
"uniform sampler2D occSampler0; //!< current active sampler;\n"
" //! occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing\n"
"uniform vec4 occColor; //!< color value (in case of disabled lighting)\n"
"uniform THE_PREC_ENUM int occDistinguishingMode; //!< Are front and back faces distinguished?\n"
"uniform THE_PREC_ENUM int occTextureEnable; //!< Is texture enabled?\n"
"uniform sampler2D occActiveSampler; //!< Current active sampler\n"
"uniform vec4 occTexTrsf2d[2]; //!< 2D texture transformation parameters\n"
"uniform float occPointSize; //!< point size\n"
"\n"