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
ac660913
Commit
ac660913
authored
12 years ago
by
Ansgar Philippsen
Browse files
Options
Downloads
Patches
Plain Diff
added missing file
parent
99f238bb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/gfx/src/exporter.cc
+62
-0
62 additions, 0 deletions
modules/gfx/src/exporter.cc
with
62 additions
and
0 deletions
modules/gfx/src/exporter.cc
0 → 100644
+
62
−
0
View file @
ac660913
//------------------------------------------------------------------------------
// This file is part of the OpenStructure project <www.openstructure.org>
//
// Copyright (C) 2008-2011 by the OpenStructure authors
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the Free
// Software Foundation; either version 3.0 of the License, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
// details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//------------------------------------------------------------------------------
#include
<ost/gfx/scene.hh>
#include
"exporter.hh"
namespace
ost
{
namespace
gfx
{
void
Exporter
::
SetupTransform
(
const
Scene
*
scene
)
{
vertex_tf_
=
geom
::
Mat4
();
normal_tf_
=
geom
::
Mat3
();
geom
::
Mat4
Tmat
,
Rmat
,
Smat
,
Cmat
;
if
(
to_origin_
)
{
geom
::
Vec3
trans
=
scene
->
GetTransform
().
GetTrans
();
geom
::
Vec3
cen
=
scene
->
GetTransform
().
GetCenter
();
vertex_tf_
=
geom
::
Mat4
(
scene
->
GetTransform
().
GetRot
())
*
geom
::
Mat4
(
scale_
,
0.0
,
0.0
,
0.0
,
0.0
,
scale_
,
0.0
,
0.0
,
0.0
,
0.0
,
scale_
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
)
*
geom
::
Mat4
(
1.0
,
0.0
,
0.0
,
-
cen
[
0
],
0.0
,
1.0
,
0.0
,
-
cen
[
1
],
0.0
,
0.0
,
1.0
,
-
cen
[
2
],
0.0
,
0.0
,
0.0
,
1.0
);
normal_tf_
=
scene
->
GetTransform
().
GetRot
();
}
else
{
vertex_tf_
=
geom
::
Mat4
(
scale_
,
0.0
,
0.0
,
0.0
,
0.0
,
scale_
,
0.0
,
0.0
,
0.0
,
0.0
,
scale_
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
);
}
}
void
Exporter
::
TransformPosition
(
float
*
v
)
const
{
geom
::
Vec3
result
(
vertex_tf_
*
geom
::
Vec4
(
v
[
0
],
v
[
1
],
v
[
2
],
1.0
));
v
[
0
]
=
result
[
0
];
v
[
1
]
=
result
[
1
];
v
[
2
]
=
result
[
2
];
}
void
Exporter
::
TransformNormal
(
float
*
n
)
const
{
geom
::
Vec3
result
=
normal_tf_
*
geom
::
Vec3
(
n
[
0
],
n
[
1
],
n
[
2
]);
n
[
0
]
=
result
[
0
];
n
[
1
]
=
result
[
1
];
n
[
2
]
=
result
[
2
];
}
}}
// ns
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