Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openstructure
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
schwede
openstructure
Commits
0137b0fd
Commit
0137b0fd
authored
12 years ago
by
Ansgar Philippsen
Browse files
Options
Downloads
Patches
Plain Diff
another set of fixes for spacenav; tweaks to gfx logging
parent
e1bf8196
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
modules/base/pymod/export_logger.cc
+12
-1
12 additions, 1 deletion
modules/base/pymod/export_logger.cc
modules/gfx/src/shader.cc
+9
-9
9 additions, 9 deletions
modules/gfx/src/shader.cc
modules/gui/pymod/init_spacenav.py
+24
-13
24 additions, 13 deletions
modules/gui/pymod/init_spacenav.py
with
45 additions
and
23 deletions
modules/base/pymod/export_logger.cc
+
12
−
1
View file @
0137b0fd
...
...
@@ -132,7 +132,16 @@ object log_verbose(tuple args, dict kwargs)
LOG_VERBOSE
(
args_to_string
(
args
,
kwargs
));
return
object
();
}
object
log_debug
(
tuple
args
,
dict
kwargs
)
{
LOG_DEBUG
(
args_to_string
(
args
,
kwargs
));
return
object
();
}
object
log_trace
(
tuple
args
,
dict
kwargs
)
{
LOG_TRACE
(
args_to_string
(
args
,
kwargs
));
return
object
();
}
void
reset_sinks
()
{
...
...
@@ -177,6 +186,8 @@ void export_Logger()
def
(
"LogInfo"
,
raw_function
(
log_info
,
1
));
def
(
"LogScript"
,
raw_function
(
log_script
,
1
));
def
(
"LogVerbose"
,
raw_function
(
log_verbose
,
1
));
def
(
"LogDebug"
,
raw_function
(
log_debug
,
1
));
def
(
"LogTrace"
,
raw_function
(
log_trace
,
1
));
// this relatively ugly construct is required to work around a problem with
// the "ost" command-line interpreter. If we don't remove all the sinks from
...
...
This diff is collapsed.
Click to expand it.
modules/gfx/src/shader.cc
+
9
−
9
View file @
0137b0fd
...
...
@@ -85,13 +85,13 @@ bool Shader::Compile(const std::string& shader_name,
GLint
sh_compiled
;
glGetShaderiv
(
shader_id
,
GL_COMPILE_STATUS
,
&
sh_compiled
);
if
(
sh_compiled
==
GL_TRUE
)
{
LOG_
VERBOSE
(
"shader ["
<<
shader_name
<<
"] successfully compiled ("
<<
shader_id
<<
")"
);
LOG_
DEBUG
(
"shader ["
<<
shader_name
<<
"] successfully compiled ("
<<
shader_id
<<
")"
);
}
else
{
GLint
sh_log_length
;
glGetShaderiv
(
shader_id
,
GL_INFO_LOG_LENGTH
,
&
sh_log_length
);
std
::
vector
<
GLchar
>
sh_log
(
sh_log_length
+
1
);
glGetShaderInfoLog
(
shader_id
,
sh_log_length
,
NULL
,
&
sh_log
[
0
]);
LOG_
ERROR
(
"shader ["
<<
shader_name
<<
"] compilation failed:"
<<
std
::
endl
<<
String
(
&
sh_log
[
0
]));
LOG_
WARNING
(
"shader ["
<<
shader_name
<<
"] compilation failed:"
<<
std
::
endl
<<
String
(
&
sh_log
[
0
]));
return
false
;
}
return
true
;
...
...
@@ -105,14 +105,14 @@ void Shader::Link(const std::string& pr_name, const std::string& vs_code, const
GLuint
shader_id
;
if
(
Compile
(
pr_name
+
" vs"
,
vs_code
,
GL_VERTEX_SHADER
,
shader_id
))
{
LOG_
VERBOSE
(
"attaching compiled vertex shader id "
<<
shader_id
<<
" to "
<<
shader_pr
);
LOG_
DEBUG
(
"attaching compiled vertex shader id "
<<
shader_id
<<
" to "
<<
shader_pr
);
glAttachShader
(
shader_pr
,
shader_id
);
}
else
{
LOG_WARNING
(
"skipping ["
<<
pr_name
<<
"] due to error in vertex shader code"
);
return
;
}
if
(
Compile
(
pr_name
+
" fs"
,
fs_code
,
GL_FRAGMENT_SHADER
,
shader_id
))
{
LOG_
VERBOSE
(
"attaching compiled fragment shader id "
<<
shader_id
<<
" to "
<<
shader_pr
);
LOG_
DEBUG
(
"attaching compiled fragment shader id "
<<
shader_id
<<
" to "
<<
shader_pr
);
glAttachShader
(
shader_pr
,
shader_id
);
}
else
{
LOG_WARNING
(
"skipping ["
<<
pr_name
<<
"] due to error in fragment shader code"
);
...
...
@@ -129,7 +129,7 @@ void Shader::Link(const std::string& pr_name, const std::string& vs_code, const
glGetProgramiv
(
shader_pr
,
GL_INFO_LOG_LENGTH
,
&
pr_log_length
);
std
::
vector
<
GLchar
>
pr_log
(
pr_log_length
+
1
);
glGetProgramInfoLog
(
shader_pr
,
pr_log_length
,
NULL
,
&
pr_log
[
0
]);
LOG_
ERROR
(
"shader ["
<<
pr_name
<<
"] linking failed:"
<<
std
::
endl
<<
String
(
&
pr_log
[
0
]));
LOG_
WARNING
(
"shader ["
<<
pr_name
<<
"] linking failed:"
<<
std
::
endl
<<
String
(
&
pr_log
[
0
]));
return
;
}
shader_program_map_
[
pr_name
]
=
shader_pr
;
...
...
@@ -186,7 +186,7 @@ void Shader::Setup()
bf
::
path
shader_file
(
shader_dir
/
shader_name
);
if
(
!
bf
::
exists
(
shader_file
)){
LOG_
ERROR
(
"shader file not found: ["
<<
shader_file
.
string
()
<<
"]"
);
LOG_
WARNING
(
"shader file not found: ["
<<
shader_file
.
string
()
<<
"]"
);
shader_code_map
[
shader_name
]
=
std
::
string
();
continue
;
}
...
...
@@ -297,7 +297,7 @@ void Shader::Activate(const String& name)
if
(
!
name
.
empty
())
{
std
::
map
<
String
,
GLuint
>::
iterator
it
=
shader_program_map_
.
find
(
name
);
if
(
it
!=
shader_program_map_
.
end
())
{
LOG_
VERBOS
E
(
"switching to shader ["
<<
name
<<
"]"
);
LOG_
TRAC
E
(
"switching to shader ["
<<
name
<<
"]"
);
glUseProgram
(
it
->
second
);
current_program_
=
it
->
second
;
current_name_
=
name
;
...
...
@@ -306,11 +306,11 @@ void Shader::Activate(const String& name)
return
;
}
else
{
LOG_
WARNING
(
"shader program ["
<<
name
<<
"] not present"
);
LOG_
TRACE
(
"shader program ["
<<
name
<<
"] not present"
);
return
;
}
}
LOG_
VERBOS
E
(
"switching to fixed pipeline"
);
LOG_
TRAC
E
(
"switching to fixed pipeline"
);
glUseProgram
(
0
);
current_program_
=
0
;
current_name_
=
""
;
...
...
This diff is collapsed.
Click to expand it.
modules/gui/pymod/init_spacenav.py
+
24
−
13
View file @
0137b0fd
import
traceback
import
math
,
traceback
from
PyQt4
import
QtCore
...
...
@@ -16,19 +16,30 @@ class SpacenavControl(QtCore.QObject):
self
.
rot
=
True
self
.
speed
=
480.0
def
Changed
(
self
,
tx
,
ty
,
tz
,
rx
,
ry
,
rz
):
transf
=
gfx
.
Scene
().
GetTransform
()
def
Changed
(
self
,
tx
,
ty
,
tz
,
rx
,
ry
,
rz
):
scene
=
gfx
.
Scene
()
tf
=
scene
.
transform
def
d
(
r
):
if
r
==
0.0
:
return
0.0
rr
=
r
/
abs
(
r
)
*
max
(
0.0
,
abs
(
r
)
-
0.9
)
return
rr
/
abs
(
rr
)
*
(
math
.
pow
(
1.01
,
abs
(
rr
))
-
1.0
)
*
40.0
/
self
.
speed
if
abs
(
rr
)
>
0.0
else
0.0
if
(
self
.
trans
):
transf
.
ApplyXAxisTranslation
(
tx
/
self
.
speed
)
transf
.
ApplyYAxisTranslation
(
ty
/
self
.
speed
)
tf
.
ApplyXAxisTranslation
(
d
(
tx
))
tf
.
ApplyYAxisTranslation
(
d
(
ty
))
# adjust translation speed to distance from viewpoint
currz
=
tf
.
trans
[
2
];
delta
=
currz
*
math
.
pow
(
1.01
,
d
(
tz
))
-
currz
;
tf
.
ApplyZAxisTranslation
(
delta
);
# adjust near and far clipping planes together with z trans
scene
.
SetNearFar
(
scene
.
near
-
delta
,
scene
.
far
-
delta
);
if
(
self
.
rot
):
transf
.
ApplyXAxisRotation
(
rx
/
self
.
speed
)
transf
.
ApplyYAxisRotation
(
ry
/
self
.
speed
)
transf
.
ApplyZAxisRotation
(
rz
/
self
.
speed
)
if
(
self
.
trans
or
self
.
rot
):
transf
.
ApplyZAxisTranslation
(
-
tz
/
self
.
speed
)
gfx
.
Scene
().
SetTransform
(
transf
)
gfx
.
Scene
().
RequestRedraw
()
tf
.
ApplyXAxisRotation
(
d
(
rx
))
tf
.
ApplyYAxisRotation
(
d
(
ry
))
tf
.
ApplyZAxisRotation
(
d
(
rz
))
scene
.
transform
=
tf
scene
.
RequestRedraw
()
def
Toggle
(
self
,
button
):
if
button
==
0
:
...
...
@@ -45,7 +56,7 @@ class SpacenavControl(QtCore.QObject):
self
.
speed
/=
0.8
ost
.
LogVerbose
(
"
SpaceNav: speed reduced to
"
+
str
(
self
.
speed
))
else
:
ost
.
Log
Debug
(
"
SpaceNav: unmapped button press [
"
+
str
(
button
)
+
"
]
"
)
ost
.
Log
Verbose
(
"
SpaceNav: unmapped button press [
"
+
str
(
button
)
+
"
]
"
)
def
_InitSpaceNav
(
app
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment