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
07256bf7
Commit
07256bf7
authored
Apr 25, 2017
by
Christopher Tenter
Browse files
extend renderobject info string print with:
- clipping plane bitmask - gl_PointSize stuff - shader uniform values
parent
8b1648d7
Changes
3
Hide whitespace changes
Inline
Side-by-side
libs_required/ACG/GL/RenderObject.cc
View file @
07256bf7
...
...
@@ -350,6 +350,10 @@ QString RenderObject::toString() const
resultStrm
<<
"
\n
alphaFunc: "
<<
depthFunString
[
alphaFunc
-
GL_NEVER
]
<<
"
\n
alphaRef: "
<<
alphaRef
;
resultStrm
<<
"
\n
clipDistanceMask: "
<<
QString
::
number
(
clipDistanceMask
,
2
);
resultStrm
<<
"
\n
programPointSize: "
<<
programPointSize
;
resultStrm
<<
"
\n
pointSize: "
<<
pointSize
;
resultStrm
<<
"
\n
diffuse: ["
<<
diffuse
[
0
]
<<
", "
<<
diffuse
[
1
]
<<
", "
<<
diffuse
[
2
]
<<
"]"
;
resultStrm
<<
"
\n
ambient: ["
<<
ambient
[
0
]
<<
", "
<<
ambient
[
1
]
<<
", "
<<
ambient
[
2
]
<<
"]"
;
resultStrm
<<
"
\n
specular: ["
<<
specular
[
0
]
<<
", "
<<
specular
[
1
]
<<
", "
<<
specular
[
2
]
<<
"]"
;
...
...
@@ -408,6 +412,8 @@ QString RenderObject::toString() const
if
(
vertexDecl
)
resultStrm
<<
"
\n
"
<<
vertexDecl
->
toString
();
if
(
!
uniformPool_
.
empty
())
resultStrm
<<
"
\n
"
<<
uniformPool_
.
toString
();
return
result
;
}
...
...
libs_required/ACG/ShaderUtils/UniformPool.cc
View file @
07256bf7
...
...
@@ -48,6 +48,7 @@
\*===========================================================================*/
#include
<iostream>
#include
<QTextStream>
#include
<ACG/GL/acg_glew.hh>
#include
<ACG/GL/GLError.hh>
...
...
@@ -102,6 +103,19 @@ namespace GLSL {
return
pool_
.
empty
();
}
QString
UniformPool
::
toString
()
const
{
QString
result
;
QTextStream
resultStrm
(
&
result
);
for
(
UniformList
::
const_iterator
it
=
pool_
.
begin
();
it
!=
pool_
.
end
();
++
it
)
{
resultStrm
<<
(
*
it
)
->
toString
()
<<
"
\n
"
;
}
return
result
;
}
/** \brief Send all stored uniforms to program
*
* @param _prog receiving GLSL program
...
...
@@ -200,6 +214,23 @@ namespace GLSL {
checkGLError2
(
id
.
c_str
());
}
/** \brief print float vector to string
*
*/
QString
UniformPool
::
UniformVecf
::
toString
()
const
{
const
char
*
fmt
=
size
>
1
?
"uniform vec%2 %1 = vec%2("
:
"uniform float %1 = "
;
QString
str
=
QString
(
fmt
).
arg
(
id
.
c_str
()).
arg
(
size
);
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
str
+=
QString
::
number
(
val
[
i
]);
if
(
i
+
1
<
size
)
str
+=
", "
;
}
if
(
size
>
1
)
str
+=
");"
;
return
str
;
}
/** \brief Bind uniform int vector to shader
*
* @param _progID GL Program ID
...
...
@@ -231,6 +262,23 @@ namespace GLSL {
checkGLError2
(
id
.
c_str
());
}
/** \brief print int vector to string
*
*/
QString
UniformPool
::
UniformVeci
::
toString
()
const
{
const
char
*
fmt
=
size
>
1
?
"uniform ivec%2 %1 = ivec%2("
:
"uniform int %1 = "
;
QString
str
=
QString
(
fmt
).
arg
(
id
.
c_str
()).
arg
(
size
);
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
str
+=
QString
::
number
(
val
[
i
]);
if
(
i
+
1
<
size
)
str
+=
", "
;
}
if
(
size
>
1
)
str
+=
");"
;
return
str
;
}
/** \brief Bind uniform uint vector to shader
*
* @param _progID GL Program ID
...
...
@@ -262,6 +310,23 @@ namespace GLSL {
checkGLError2
(
id
.
c_str
());
}
/** \brief print uint vector to string
*
*/
QString
UniformPool
::
UniformVecui
::
toString
()
const
{
const
char
*
fmt
=
size
>
1
?
"uniform uvec%2 %1 = uvec%2("
:
"uniform uint %1 = "
;
QString
str
=
QString
(
fmt
).
arg
(
id
.
c_str
()).
arg
(
size
);
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
str
+=
QString
::
number
(
val
[
i
]);
if
(
i
+
1
<
size
)
str
+=
", "
;
}
if
(
size
>
1
)
str
+=
");"
;
return
str
;
}
/** \brief Bind uniform matrix to shader
*
* @param _progID GL Program ID
...
...
@@ -298,6 +363,27 @@ namespace GLSL {
checkGLError2
(
id
.
c_str
());
}
/** \brief print matrix to string
*
*/
QString
UniformPool
::
UniformMat
::
toString
()
const
{
QString
str
=
QString
(
"uniform mat%2 %1 = {"
).
arg
(
id
.
c_str
()).
arg
(
size
);
for
(
int
y
=
0
;
y
<
size
;
++
y
)
{
str
+=
"{"
;
for
(
int
x
=
0
;
x
<
size
;
++
x
)
{
str
+=
QString
::
number
(
val
(
y
,
x
));
if
(
x
+
1
<
size
)
str
+=
", "
;
}
str
+=
"}"
;
if
(
y
+
1
<
size
)
str
+=
", "
;
}
str
+=
"};"
;
return
str
;
}
/** \brief Bind uniform array to shader
*
* @param _progID GL Program ID
...
...
@@ -317,6 +403,24 @@ namespace GLSL {
checkGLError2
(
id
.
c_str
());
}
/** \brief print buffer id to string
*
*/
QString
UniformPool
::
UniformBuf
::
toString
()
const
{
QString
str
=
QString
(
"uniform %3 %2[%1] = {"
).
arg
(
id
.
c_str
()).
arg
(
size
).
arg
(
integer
?
"int"
:
"float"
);
for
(
int
y
=
0
;
y
<
size
;
++
y
)
{
if
(
integer
)
str
+=
QString
::
number
(((
GLint
*
)
val
)[
y
]);
else
str
+=
QString
::
number
(
val
[
y
]);
if
(
y
+
1
<
size
)
str
+=
", "
;
}
str
+=
"};"
;
return
str
;
}
/** \brief Creates a copy of input data
*/
UniformPool
::
UniformBuf
::
UniformBuf
()
...
...
libs_required/ACG/ShaderUtils/UniformPool.hh
View file @
07256bf7
...
...
@@ -121,6 +121,11 @@ namespace GLSL {
*/
bool
empty
()
const
;
/** \brief print to string for debugging
*
*/
QString
toString
()
const
;
/** \brief copy
*
*/
...
...
@@ -135,6 +140,8 @@ namespace GLSL {
virtual
~
UniformBase
()
{}
virtual
void
bind
(
GLuint
_progID
)
const
{}
virtual
QString
toString
()
const
{
return
QString
(
""
);
}
};
struct
UniformVecf
:
public
UniformBase
{
...
...
@@ -142,6 +149,8 @@ namespace GLSL {
int
size
;
void
bind
(
GLuint
_progID
)
const
;
virtual
QString
toString
()
const
;
};
// separate float int vector because sizeof(int) != sizeof(float) for some compilers
...
...
@@ -150,6 +159,8 @@ namespace GLSL {
int
size
;
void
bind
(
GLuint
_progID
)
const
;
virtual
QString
toString
()
const
;
};
struct
UniformVecui
:
public
UniformBase
{
...
...
@@ -157,6 +168,8 @@ namespace GLSL {
int
size
;
void
bind
(
GLuint
_progID
)
const
;
virtual
QString
toString
()
const
;
};
...
...
@@ -167,6 +180,8 @@ namespace GLSL {
int
size
;
void
bind
(
GLuint
_progID
)
const
;
virtual
QString
toString
()
const
;
};
struct
UniformBuf
:
public
UniformBase
{
...
...
@@ -179,6 +194,8 @@ namespace GLSL {
~
UniformBuf
();
void
bind
(
GLuint
_progID
)
const
;
virtual
QString
toString
()
const
;
};
...
...
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