Toggle navigation
Toggle navigation
This project
Loading...
Sign in
arcs
/
ARCS2-Components
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Yves Didier
2013-08-16 20:35:47 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
33eda02081dd0c00ee9afe74eceffe57019b9771
33eda020
1 parent
1211a534
Inclusion des types et serialisation.
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
4 deletions
scene/osg/osgstringserializer.cpp
scene/osg/osgstringserializer.h
scene/osg/osgtypes.h
scene/osg/osgstringserializer.cpp
View file @
33eda02
...
...
@@ -40,8 +40,7 @@ QString OSGStringSerializer::toString(osg::ref_ptr<osg::Object> target)
OSGStringSerializer
::
OSGStringSerializer
()
:
binaryInputStream
(
0
),
binaryOutputStream
(
0
),
inputStream
(
0
),
outputStream
(
0
)
binaryInputStream
(
0
),
binaryOutputStream
(
0
)
{
bip
=
new
BinaryInputIterator
(
&
source
);
bop
=
new
BinaryOutputIterator
(
&
source
);
...
...
scene/osg/osgstringserializer.h
View file @
33eda02
...
...
@@ -34,8 +34,6 @@ private:
std
::
stringstream
source
;
osgDB
::
InputStream
binaryInputStream
;
osgDB
::
OutputStream
binaryOutputStream
;
osgDB
::
InputStream
inputStream
;
osgDB
::
OutputStream
outputStream
;
BinaryInputIterator
*
bip
;
BinaryOutputIterator
*
bop
;
osgDB
::
ReaderWriter
*
osgRW
;
...
...
scene/osg/osgtypes.h
View file @
33eda02
...
...
@@ -16,6 +16,10 @@
#include <osg/Matrixf>
#include <osg/Matrixd>
#include <osg/ValueObject>
#include "osgstringserializer.h"
#include <typeinfo>
template
<
typename
T
>
class
OSGType
:
public
ARCSTypeFactoryTemplate
<
T
>
...
...
@@ -37,9 +41,79 @@ template<typename T> QString OSGType<T>::getTypeName() const
template
<
typename
T
>
T
OSGType
<
T
>::
parse
(
QString
s
)
{
osg
::
ref_ptr
<
osg
::
Object
>
object
=
OSGStringSerializer
::
getInstance
()
->
parseString
(
s
);
osg
::
TemplateValueObject
<
T
>*
value
;
if
((
value
=
dynamic_cast
<
osg
::
TemplateValueObject
<
T
>*
>
(
object
.
get
())))
return
value
->
getValue
();
return
T
();
}
template
<
typename
T
>
QString
OSGType
<
T
>::
serialize
(
T
obj
)
{
osg
::
TemplateValueObject
<
T
>
value
;
value
.
setValue
(
obj
);
return
OSGStringSerializer
::
getInstance
()
->
toString
(
&
value
);
}
///////////////////////////////////////////////////////////////////////////
// Here are declarations of types
//////////////////////////////////////////////////////////////////////////
typedef
osg
::
Vec2f
osgVec2f
;
Q_DECLARE_METATYPE
(
osgVec2f
)
template
class
OSGType
<
osgVec2f
>
;
typedef
OSGType
<
osgVec2f
>
ARCSTypeFactoryTemplate_osgVec2f
;
typedef
osg
::
Vec2d
osgVec2d
;
Q_DECLARE_METATYPE
(
osgVec2d
)
template
class
OSGType
<
osgVec2d
>
;
typedef
OSGType
<
osgVec2d
>
ARCSTypeFactoryTemplate_osgVec2d
;
typedef
osg
::
Vec3f
osgVec3f
;
Q_DECLARE_METATYPE
(
osgVec3f
)
template
class
OSGType
<
osgVec3f
>
;
typedef
OSGType
<
osgVec3f
>
ARCSTypeFactoryTemplate_osgVec3f
;
typedef
osg
::
Vec3d
osgVec3d
;
Q_DECLARE_METATYPE
(
osgVec3d
)
template
class
OSGType
<
osgVec3d
>
;
typedef
OSGType
<
osgVec3d
>
ARCSTypeFactoryTemplate_osgVec3d
;
typedef
osg
::
Vec4f
osgVec4f
;
Q_DECLARE_METATYPE
(
osgVec4f
)
template
class
OSGType
<
osgVec4f
>
;
typedef
OSGType
<
osgVec4f
>
ARCSTypeFactoryTemplate_osgVec4f
;
typedef
osg
::
Vec4d
osgVec4d
;
Q_DECLARE_METATYPE
(
osgVec4d
)
template
class
OSGType
<
osgVec4d
>
;
typedef
OSGType
<
osgVec4d
>
ARCSTypeFactoryTemplate_osgVec4d
;
typedef
osg
::
Quat
osgQuat
;
Q_DECLARE_METATYPE
(
osgQuat
)
template
class
OSGType
<
osgQuat
>
;
typedef
OSGType
<
osgQuat
>
ARCSTypeFactoryTemplate_osgQuat
;
typedef
osg
::
Plane
osgPlane
;
Q_DECLARE_METATYPE
(
osgPlane
)
template
class
OSGType
<
osgPlane
>
;
typedef
OSGType
<
osgPlane
>
ARCSTypeFactoryTemplate_osgPlane
;
typedef
osg
::
Matrixf
osgMatrixf
;
Q_DECLARE_METATYPE
(
osgMatrixf
)
template
class
OSGType
<
osgMatrixf
>
;
typedef
OSGType
<
osgMatrixf
>
ARCSTypeFactoryTemplate_osgMatrixf
;
typedef
osg
::
Matrixd
osgMatrixd
;
Q_DECLARE_METATYPE
(
osgMatrixd
)
template
class
OSGType
<
osgMatrixd
>
;
typedef
OSGType
<
osgMatrixd
>
ARCSTypeFactoryTemplate_osgMatrixd
;
#endif // __OSGTYPES_H__
...
...
Please
register
or
login
to post a comment