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
375887a2
Commit
375887a2
authored
Dec 20, 2016
by
Christopher Tenter
Browse files
add option to set vertex normal interpolation qualifier
parent
99fdec87
Changes
4
Hide whitespace changes
Inline
Side-by-side
libs_required/ACG/GL/RenderObject.cc
View file @
375887a2
...
...
@@ -162,6 +162,9 @@ void RenderObject::setupShaderGenFromDrawmode( const SceneGraph::DrawModes::Draw
if
(
_props
->
flatShaded
())
shaderDesc
.
shadeMode
=
SG_SHADE_FLAT
;
if
(
_props
->
normalSource
()
==
SceneGraph
::
DrawModes
::
NORMAL_PER_FACE
)
shaderDesc
.
vertexNormalInterpolator
=
"flat"
;
if
(
_props
->
primitive
()
==
SceneGraph
::
DrawModes
::
PRIMITIVE_WIREFRAME
||
_props
->
primitive
()
==
SceneGraph
::
DrawModes
::
PRIMITIVE_HIDDENLINE
||
_props
->
primitive
()
==
SceneGraph
::
DrawModes
::
PRIMITIVE_EDGE
||
...
...
libs_required/ACG/GL/ShaderGenerator.cc
View file @
375887a2
...
...
@@ -178,11 +178,10 @@ void ShaderGenerator::initVertexShaderIO(const ShaderGenDesc* _desc, const Defau
addInput
(
"vec4"
,
keywords
.
vs_inputColor
);
if
(
_iodesc
->
passNormalVS_
)
add
Outpu
t
(
"vec3
"
,
keywords
.
vs_outputNormalVS
);
add
StringToLis
t
(
"vec3
"
+
keywords
.
vs_outputNormalVS
,
&
outputs_
,
_desc
->
vertexNormalInterpolator
+
" out "
,
";"
);
if
(
_iodesc
->
passNormalOS_
)
addOutput
(
"vec3"
,
keywords
.
vs_outputNormalOS
);
addStringToList
(
"vec3 "
+
keywords
.
vs_outputNormalOS
,
&
outputs_
,
_desc
->
vertexNormalInterpolator
+
" out "
,
";"
);
// vertex color output
...
...
libs_required/ACG/GL/ShaderGenerator.hh
View file @
375887a2
...
...
@@ -170,6 +170,9 @@ public:
/// interpolation qualifier for input vertex colors: "flat", "smooth", "noperspective"
QString
vertexColorsInterpolator
;
/// interpolation qualifier for vertex shader normal outputs: "flat", "smooth", "noperspective"
QString
vertexNormalInterpolator
;
// color material for input vertex colors: GL_EMISSION, GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_AMBIENT_AND_DIFFUSE
// Usage of vertex colors in lighting function, as diffuse, emission, ambient color .. see glColorMaterial()
// default: GL_AMBIENT_AND_DIFFUSE
...
...
@@ -309,6 +312,9 @@ public:
if
(
shaderMods
!=
_rhs
.
shaderMods
)
return
false
;
if
(
vertexNormalInterpolator
!=
_rhs
.
vertexNormalInterpolator
)
return
false
;
if
(
numLights
)
return
memcmp
(
lightTypes
,
_rhs
.
lightTypes
,
numLights
*
sizeof
(
ShaderGenLightType
))
==
0
;
...
...
libs_required/ACG/Scenegraph/MeshNode2T.cc
View file @
375887a2
...
...
@@ -773,6 +773,9 @@ void ACG::SceneGraph::MeshNodeT<Mesh>::getRenderObjects( IRenderer* _renderer, G
if
(
props
->
flatShaded
())
ro
.
shaderDesc
.
shadeMode
=
SG_SHADE_FLAT
;
if
(
props
->
normalSource
()
==
DrawModes
::
NORMAL_PER_FACE
)
ro
.
shaderDesc
.
vertexNormalInterpolator
=
"flat"
;
// handle 'special' primitives (wireframe, hiddenline, primitives in sysmem buffers)..
if
(
props
->
primitive
()
==
DrawModes
::
PRIMITIVE_WIREFRAME
)
...
...
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