Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
1b2303c1
Commit
1b2303c1
authored
Apr 27, 2017
by
Christopher Tenter
Browse files
fix compile error
parent
1ac6322f
Changes
3
Hide whitespace changes
Inline
Side-by-side
libs_required/ACG/GL/ShaderGenerator.cc
View file @
1b2303c1
...
...
@@ -1615,6 +1615,24 @@ void ShaderProgGenerator::buildGeometryShader()
mainCode
.
push_back
(
"gl_Position = gl_in[inIdx].gl_Position;"
);
mainCode
.
push_back
(
"gl_PrimitiveID = gl_PrimitiveIDIn;"
);
// built-in gl_ClipDistance[]
static
int
maxClipDistances
=
-
1
;
if
(
maxClipDistances
<
0
)
{
#ifdef GL_MAX_CLIP_DISTANCES
glGetIntegerv
(
GL_MAX_CLIP_DISTANCES
,
&
maxClipDistances
);
maxClipDistances
=
std
::
min
(
maxClipDistances
,
32
);
// clamp to 32 bits
#else
maxClipDistances
=
32
;
#endif
}
for
(
int
i
=
0
;
i
<
maxClipDistances
;
++
i
)
{
if
(
desc_
.
clipDistanceMask
&
(
1
<<
i
))
mainCode
.
push_back
(
QString
(
"gl_ClipDistance[%1] = gl_in[inIdx].gl_ClipDistance[%1];"
).
arg
(
i
));
}
// custom IO
for
(
int
i
=
0
;
i
<
geometry_
->
getNumInputs
();
++
i
)
{
...
...
@@ -2720,7 +2738,7 @@ QString ShaderGenDesc::toString() const
resStrm
<<
"version: "
<<
version
;
resStrm
<<
"shaderDesc.numLights: "
<<
numLights
;
resStrm
<<
"
\n
shaderDesc.numLights: "
<<
numLights
;
if
(
numLights
)
{
...
...
libs_required/ACG/GL/ShaderGenerator.hh
View file @
1b2303c1
...
...
@@ -102,6 +102,7 @@ public:
fragmentTemplateFile
(
""
),
normalizeTexColors
(
true
),
colorMaterialMode
(
GL_AMBIENT_AND_DIFFUSE
),
clipDistanceMask
(
0
),
textureTypes_
(),
texGenDim
(
0
),
texGenMode
(
GL_EYE_LINEAR
),
...
...
@@ -178,6 +179,11 @@ public:
// default: GL_AMBIENT_AND_DIFFUSE
GLenum
colorMaterialMode
;
// Bitmask of enabled hardware clip planes.
// Bit i represents the i'th clip plane starting at the least significant bit.
// This is needed to pass the gl_ClipDistance[] array through the geometry shader stage.
uint
clipDistanceMask
;
struct
TextureType
{
GLenum
type
;
...
...
@@ -279,6 +285,13 @@ public:
return
false
;
}
if
(
!
geometryTemplateFile
.
isEmpty
())
{
// clip distance mask only affects the geometry shader
if
(
clipDistanceMask
!=
_rhs
.
clipDistanceMask
)
return
false
;
}
if
(
fragmentTemplateFile
!=
_rhs
.
fragmentTemplateFile
)
return
false
;
...
...
libs_required/ACG/Scenegraph/ClippingNode.cc
View file @
1b2303c1
...
...
@@ -248,6 +248,8 @@ void ClippingNode::ClippingObjectModifier::apply(RenderObject* _obj)
// set shader modifier
_obj
->
shaderDesc
.
shaderMods
.
push_back
(
shaderModID
);
// enable clip distance pass through in geometry shader
_obj
->
shaderDesc
.
clipDistanceMask
=
_obj
->
clipDistanceMask
;
}
//=============================================================================
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment