Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
af657fc8
Commit
af657fc8
authored
Aug 05, 2014
by
unknown
Committed by
jean-pierre charras
Aug 05, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
3d-viewer: fix compil warning, by Mario Luzeiro, with some coding style fixes.
parent
242d42cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
70 deletions
+137
-70
3d_frame.cpp
3d-viewer/3d_frame.cpp
+3
-4
vrml_aux.cpp
3d-viewer/vrml_aux.cpp
+3
-2
vrml_v2_modelparser.cpp
3d-viewer/vrml_v2_modelparser.cpp
+131
-64
No files found.
3d-viewer/3d_frame.cpp
View file @
af657fc8
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <fctsys.h>
#include <fctsys.h>
#include <kiface_i.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include <pgm_base.h>
#include <macros.h>
#include <3d_viewer.h>
#include <3d_viewer.h>
#include <3d_canvas.h>
#include <3d_canvas.h>
...
@@ -133,8 +134,6 @@ EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
...
@@ -133,8 +134,6 @@ EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
#if wxCHECK_VERSION( 3, 0, 0 )
#if wxCHECK_VERSION( 3, 0, 0 )
unsigned
int
ii
;
// Check if the canvas supports multisampling.
// Check if the canvas supports multisampling.
if
(
EDA_3D_CANVAS
::
IsDisplaySupported
(
attrs
)
)
if
(
EDA_3D_CANVAS
::
IsDisplaySupported
(
attrs
)
)
{
{
...
@@ -142,7 +141,7 @@ EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
...
@@ -142,7 +141,7 @@ EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
int
maxSamples
=
8
;
// Any higher doesn't change anything.
int
maxSamples
=
8
;
// Any higher doesn't change anything.
int
samplesOffset
=
0
;
int
samplesOffset
=
0
;
for
(
ii
=
0
;
ii
<
sizeof
(
attrs
)
/
sizeof
(
attrs
[
0
]
)
-
1
;
ii
+=
2
)
for
(
unsigned
int
ii
=
0
;
ii
<
DIM
(
attrs
)
;
ii
+=
2
)
{
{
if
(
attrs
[
ii
]
==
WX_GL_SAMPLES
)
if
(
attrs
[
ii
]
==
WX_GL_SAMPLES
)
{
{
...
@@ -162,7 +161,7 @@ EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
...
@@ -162,7 +161,7 @@ EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
else
else
{
{
// Disable multisampling
// Disable multisampling
for
(
ii
=
0
;
ii
<
sizeof
(
attrs
)
/
sizeof
(
attrs
[
0
]
)
-
1
;
ii
+=
2
)
for
(
unsigned
int
ii
=
0
;
ii
<
DIM
(
attrs
)
;
ii
+=
2
)
{
{
if
(
attrs
[
ii
]
==
WX_GL_SAMPLE_BUFFERS
)
if
(
attrs
[
ii
]
==
WX_GL_SAMPLE_BUFFERS
)
{
{
...
...
3d-viewer/vrml_aux.cpp
View file @
af657fc8
...
@@ -107,9 +107,10 @@ char* GetNextTag( FILE* File, char* tag )
...
@@ -107,9 +107,10 @@ char* GetNextTag( FILE* File, char* tag )
if
(
(
c
!=
'}'
)
&&
(
c
!=
']'
)
)
if
(
(
c
!=
'}'
)
&&
(
c
!=
']'
)
)
{
{
char
*
dst
=
&
tag
[
1
];
char
*
dst
=
&
tag
[
1
];
while
(
fscanf
(
File
,
"%c"
,
dst
)
)
while
(
fscanf
(
File
,
"%c"
,
dst
)
)
{
{
if
(
(
*
dst
==
' '
)
||
(
*
dst
==
'['
)
||
(
*
dst
==
'{'
)
||
(
*
dst
==
'\t'
)
||
(
*
dst
==
'\n'
)
||
(
*
dst
==
'\r'
)
)
if
(
(
*
dst
==
' '
)
||
(
*
dst
==
'['
)
||
(
*
dst
==
'{'
)
||
(
*
dst
==
'\t'
)
||
(
*
dst
==
'\n'
)
||
(
*
dst
==
'\r'
)
)
{
{
*
dst
=
0
;
*
dst
=
0
;
break
;
break
;
...
...
3d-viewer/vrml_v2_modelparser.cpp
View file @
af657fc8
...
@@ -76,7 +76,7 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -76,7 +76,7 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
glm
::
vec3
matScale
(
GetMaster
()
->
m_MatScale
.
x
,
GetMaster
()
->
m_MatScale
.
y
,
GetMaster
()
->
m_MatScale
.
z
);
glm
::
vec3
matScale
(
GetMaster
()
->
m_MatScale
.
x
,
GetMaster
()
->
m_MatScale
.
y
,
GetMaster
()
->
m_MatScale
.
z
);
glm
::
vec3
matRot
(
GetMaster
()
->
m_MatRotation
.
x
,
GetMaster
()
->
m_MatRotation
.
y
,
GetMaster
()
->
m_MatRotation
.
z
);
glm
::
vec3
matRot
(
GetMaster
()
->
m_MatRotation
.
x
,
GetMaster
()
->
m_MatRotation
.
y
,
GetMaster
()
->
m_MatRotation
.
z
);
glm
::
vec3
matPos
(
GetMaster
()
->
m_MatPosition
.
x
,
GetMaster
()
->
m_MatPosition
.
y
,
GetMaster
()
->
m_MatPosition
.
z
);
glm
::
vec3
matPos
(
GetMaster
()
->
m_MatPosition
.
x
,
GetMaster
()
->
m_MatPosition
.
y
,
GetMaster
()
->
m_MatPosition
.
z
);
#define SCALE_3D_CONV ((IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB)
#define SCALE_3D_CONV ((IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB)
...
@@ -85,7 +85,7 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -85,7 +85,7 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
glRotatef
(
-
matRot
.
z
,
0.0
f
,
0.0
f
,
1.0
f
);
glRotatef
(
-
matRot
.
z
,
0.0
f
,
0.0
f
,
1.0
f
);
glRotatef
(
-
matRot
.
y
,
0.0
f
,
1.0
f
,
0.0
f
);
glRotatef
(
-
matRot
.
y
,
0.0
f
,
1.0
f
,
0.0
f
);
glRotatef
(
-
matRot
.
x
,
1.0
f
,
0.0
f
,
0.0
f
);
glRotatef
(
-
matRot
.
x
,
1.0
f
,
0.0
f
,
0.0
f
);
glScalef
(
matScale
.
x
,
matScale
.
y
,
matScale
.
z
);
glScalef
(
matScale
.
x
,
matScale
.
y
,
matScale
.
z
);
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
...
@@ -108,8 +108,9 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -108,8 +108,9 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
childs
.
push_back
(
m_model
);
childs
.
push_back
(
m_model
);
read_Transform
();
read_Transform
();
}
else
if
(
strcmp
(
text
,
"DEF"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"DEF"
)
==
0
)
{
{
m_model
=
new
S3D_MESH
();
m_model
=
new
S3D_MESH
();
...
@@ -123,7 +124,7 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -123,7 +124,7 @@ void VRML2_MODEL_PARSER::Load( const wxString aFilename )
SetLocaleTo_Default
();
// revert to the current locale
SetLocaleTo_Default
();
// revert to the current locale
//DBG( printf( "chils size:%lu\n", childs.size() ) );
//DBG( printf( "chils size:%lu\n", childs.size() ) );
if
(
GetMaster
()
->
IsOpenGlAllowed
()
)
if
(
GetMaster
()
->
IsOpenGlAllowed
()
)
{
{
...
@@ -139,7 +140,7 @@ int VRML2_MODEL_PARSER::read_Transform()
...
@@ -139,7 +140,7 @@ int VRML2_MODEL_PARSER::read_Transform()
{
{
char
text
[
128
];
char
text
[
128
];
//DBG( printf( "Transform\n" ) );
//DBG( printf( "Transform\n" ) );
while
(
GetNextTag
(
m_file
,
text
)
)
while
(
GetNextTag
(
m_file
,
text
)
)
{
{
...
@@ -149,42 +150,79 @@ int VRML2_MODEL_PARSER::read_Transform()
...
@@ -149,42 +150,79 @@ int VRML2_MODEL_PARSER::read_Transform()
}
}
if
(
(
*
text
==
'}'
)
)
if
(
(
*
text
==
'}'
)
)
{
{
//DBG( printf( " } Exit Transform\n" ) );
//DBG( printf( " } Exit Transform\n" ) );
break
;
break
;
}
}
if
(
strcmp
(
text
,
"translation"
)
==
0
)
if
(
strcmp
(
text
,
"translation"
)
==
0
)
{
{
parseVertex
(
m_file
,
m_model
->
m_translation
);
parseVertex
(
m_file
,
m_model
->
m_translation
);
}
else
if
(
strcmp
(
text
,
"rotation"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"rotation"
)
==
0
)
{
{
fscanf
(
m_file
,
"%f %f %f %f"
,
&
m_model
->
m_rotation
[
0
],
&
m_model
->
m_rotation
[
1
],
&
m_model
->
m_rotation
[
2
],
&
m_model
->
m_rotation
[
3
]);
if
(
fscanf
(
m_file
,
"%f %f %f %f"
,
&
m_model
->
m_rotation
[
0
],
m_model
->
m_rotation
[
3
]
=
m_model
->
m_rotation
[
3
]
*
180.0
f
/
3.14
f
;
// !TODO: use constants or functions
&
m_model
->
m_rotation
[
1
],
}
else
if
(
strcmp
(
text
,
"scale"
)
==
0
)
&
m_model
->
m_rotation
[
2
],
&
m_model
->
m_rotation
[
3
]
)
!=
4
)
{
// !TODO: log errors
m_model
->
m_rotation
[
0
]
=
0.0
f
;
m_model
->
m_rotation
[
1
]
=
0.0
f
;
m_model
->
m_rotation
[
2
]
=
0.0
f
;
m_model
->
m_rotation
[
3
]
=
0.0
f
;
}
else
{
m_model
->
m_rotation
[
3
]
=
m_model
->
m_rotation
[
3
]
*
180.0
f
/
3.14
f
;
// !TODO: use constants or functions
}
}
else
if
(
strcmp
(
text
,
"scale"
)
==
0
)
{
{
parseVertex
(
m_file
,
m_model
->
m_scale
);
parseVertex
(
m_file
,
m_model
->
m_scale
);
}
else
if
(
strcmp
(
text
,
"scaleOrientation"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"scaleOrientation"
)
==
0
)
{
{
fscanf
(
m_file
,
"%f %f %f %f"
,
&
m_model
->
m_scaleOrientation
[
0
],
&
m_model
->
m_scaleOrientation
[
1
],
&
m_model
->
m_scaleOrientation
[
2
],
&
m_model
->
m_scaleOrientation
[
3
]);
// this m_scaleOrientation is not implemented, but it will be parsed
}
else
if
(
strcmp
(
text
,
"center"
)
==
0
)
if
(
fscanf
(
m_file
,
"%f %f %f %f"
,
&
m_model
->
m_scaleOrientation
[
0
],
&
m_model
->
m_scaleOrientation
[
1
],
&
m_model
->
m_scaleOrientation
[
2
],
&
m_model
->
m_scaleOrientation
[
3
]
)
!=
4
)
{
// !TODO: log errors
m_model
->
m_scaleOrientation
[
0
]
=
0.0
f
;
m_model
->
m_scaleOrientation
[
1
]
=
0.0
f
;
m_model
->
m_scaleOrientation
[
2
]
=
0.0
f
;
m_model
->
m_scaleOrientation
[
3
]
=
0.0
f
;
}
}
else
if
(
strcmp
(
text
,
"center"
)
==
0
)
{
{
parseVertex
(
m_file
,
m_model
->
m_center
);
parseVertex
(
m_file
,
m_model
->
m_center
);
}
else
if
(
strcmp
(
text
,
"children"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"children"
)
==
0
)
{
{
// skip
// skip
}
else
if
(
strcmp
(
text
,
"Switch"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"Switch"
)
==
0
)
{
{
// skip
// skip
}
else
if
(
strcmp
(
text
,
"whichChoice"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"whichChoice"
)
==
0
)
{
{
int
dummy
;
int
dummy
;
fscanf
(
m_file
,
"%d"
,
&
dummy
);
if
(
fscanf
(
m_file
,
"%d"
,
&
dummy
)
!=
1
)
}
else
if
(
strcmp
(
text
,
"choice"
)
==
0
)
{
// !TODO: log errors
}
}
else
if
(
strcmp
(
text
,
"choice"
)
==
0
)
{
{
// skip
// skip
}
else
if
(
strcmp
(
text
,
"Group"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"Group"
)
==
0
)
{
{
// skip
// skip
}
else
if
(
strcmp
(
text
,
"Shape"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"Shape"
)
==
0
)
{
{
S3D_MESH
*
parent
=
m_model
;
S3D_MESH
*
parent
=
m_model
;
...
@@ -198,10 +236,12 @@ int VRML2_MODEL_PARSER::read_Transform()
...
@@ -198,10 +236,12 @@ int VRML2_MODEL_PARSER::read_Transform()
m_model
=
parent
;
m_model
=
parent
;
}
else
if
(
strcmp
(
text
,
"DEF"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"DEF"
)
==
0
)
{
{
read_DEF
();
read_DEF
();
}
else
}
else
{
{
DBG
(
printf
(
" %s NotImplemented
\n
"
,
text
)
);
DBG
(
printf
(
" %s NotImplemented
\n
"
,
text
)
);
read_NotImplemented
(
m_file
,
'}'
);
read_NotImplemented
(
m_file
,
'}'
);
...
@@ -238,16 +278,20 @@ int VRML2_MODEL_PARSER::read_DEF()
...
@@ -238,16 +278,20 @@ int VRML2_MODEL_PARSER::read_DEF()
}
else
if
(
strcmp
(
text
,
"children"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"children"
)
==
0
)
{
{
// skip
// skip
}
else
if
(
strcmp
(
text
,
"Switch"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"Switch"
)
==
0
)
{
{
// skip
// skip
}
else
if
(
strcmp
(
text
,
"whichChoice"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"whichChoice"
)
==
0
)
{
{
// skip
// skip
}
else
if
(
strcmp
(
text
,
"choice"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"choice"
)
==
0
)
{
{
// skip
// skip
}
else
if
(
strcmp
(
text
,
"Shape"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"Shape"
)
==
0
)
{
{
S3D_MESH
*
parent
=
m_model
;
S3D_MESH
*
parent
=
m_model
;
...
@@ -290,16 +334,20 @@ int VRML2_MODEL_PARSER::read_Shape()
...
@@ -290,16 +334,20 @@ int VRML2_MODEL_PARSER::read_Shape()
if
(
strcmp
(
text
,
"appearance"
)
==
0
)
if
(
strcmp
(
text
,
"appearance"
)
==
0
)
{
{
//skip
//skip
}
else
if
(
strcmp
(
text
,
"Appearance"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"Appearance"
)
==
0
)
{
{
read_Appearance
();
read_Appearance
();
}
else
if
(
strcmp
(
text
,
"geometry"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"geometry"
)
==
0
)
{
{
//skip
//skip
}
else
if
(
strcmp
(
text
,
"IndexedFaceSet"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"IndexedFaceSet"
)
==
0
)
{
{
read_IndexedFaceSet
();
read_IndexedFaceSet
();
}
else
}
else
{
{
DBG
(
printf
(
" %s NotImplemented
\n
"
,
text
)
);
DBG
(
printf
(
" %s NotImplemented
\n
"
,
text
)
);
read_NotImplemented
(
m_file
,
'}'
);
read_NotImplemented
(
m_file
,
'}'
);
...
@@ -344,11 +392,11 @@ int VRML2_MODEL_PARSER::read_material()
...
@@ -344,11 +392,11 @@ int VRML2_MODEL_PARSER::read_material()
{
{
S3D_MATERIAL
*
material
=
NULL
;
S3D_MATERIAL
*
material
=
NULL
;
char
text
[
128
];
char
text
[
128
];
//DBG( printf( " material ") );
//DBG( printf( " material ") );
if
(
GetNextTag
(
m_file
,
text
)
)
if
(
GetNextTag
(
m_file
,
text
)
)
{
{
if
(
strcmp
(
text
,
"Material"
)
==
0
)
if
(
strcmp
(
text
,
"Material"
)
==
0
)
{
{
wxString
mat_name
;
wxString
mat_name
;
...
@@ -362,12 +410,13 @@ int VRML2_MODEL_PARSER::read_material()
...
@@ -362,12 +410,13 @@ int VRML2_MODEL_PARSER::read_material()
{
{
return
read_Material
();
return
read_Material
();
}
}
}
else
if
(
strcmp
(
text
,
"DEF"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"DEF"
)
==
0
)
{
{
//DBG( printf( "DEF") );
//DBG( printf( "DEF") );
if
(
GetNextTag
(
m_file
,
text
)
)
if
(
GetNextTag
(
m_file
,
text
)
)
{
{
//DBG( printf( "%s", text ) );
//DBG( printf( "%s", text ) );
wxString
mat_name
;
wxString
mat_name
;
...
@@ -387,12 +436,13 @@ int VRML2_MODEL_PARSER::read_material()
...
@@ -387,12 +436,13 @@ int VRML2_MODEL_PARSER::read_material()
}
}
}
}
}
}
}
else
if
(
strcmp
(
text
,
"USE"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"USE"
)
==
0
)
{
{
//DBG( printf( "USE") );
//DBG( printf( "USE") );
if
(
GetNextTag
(
m_file
,
text
)
)
if
(
GetNextTag
(
m_file
,
text
)
)
{
{
//DBG( printf( "%s\n", text ) );
//DBG( printf( "%s\n", text ) );
wxString
mat_name
;
wxString
mat_name
;
...
@@ -450,7 +500,8 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -450,7 +500,8 @@ int VRML2_MODEL_PARSER::read_Material()
{
{
m_model
->
m_Materials
->
m_EmissiveColor
.
push_back
(
vertex
);
m_model
->
m_Materials
->
m_EmissiveColor
.
push_back
(
vertex
);
}
}
}
else
if
(
strcmp
(
text
,
"specularColor"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"specularColor"
)
==
0
)
{
{
//DBG( printf( " specularColor") );
//DBG( printf( " specularColor") );
parseVertex
(
m_file
,
vertex
);
parseVertex
(
m_file
,
vertex
);
...
@@ -459,7 +510,8 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -459,7 +510,8 @@ int VRML2_MODEL_PARSER::read_Material()
{
{
m_model
->
m_Materials
->
m_SpecularColor
.
push_back
(
vertex
);
m_model
->
m_Materials
->
m_SpecularColor
.
push_back
(
vertex
);
}
}
}
else
if
(
strcmp
(
text
,
"ambientIntensity"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"ambientIntensity"
)
==
0
)
{
{
float
ambientIntensity
;
float
ambientIntensity
;
parseFloat
(
m_file
,
&
ambientIntensity
);
parseFloat
(
m_file
,
&
ambientIntensity
);
...
@@ -468,7 +520,8 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -468,7 +520,8 @@ int VRML2_MODEL_PARSER::read_Material()
{
{
m_model
->
m_Materials
->
m_AmbientColor
.
push_back
(
glm
::
vec3
(
ambientIntensity
,
ambientIntensity
,
ambientIntensity
)
);
m_model
->
m_Materials
->
m_AmbientColor
.
push_back
(
glm
::
vec3
(
ambientIntensity
,
ambientIntensity
,
ambientIntensity
)
);
}
}
}
else
if
(
strcmp
(
text
,
"transparency"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"transparency"
)
==
0
)
{
{
float
transparency
;
float
transparency
;
parseFloat
(
m_file
,
&
transparency
);
parseFloat
(
m_file
,
&
transparency
);
...
@@ -477,7 +530,8 @@ int VRML2_MODEL_PARSER::read_Material()
...
@@ -477,7 +530,8 @@ int VRML2_MODEL_PARSER::read_Material()
{
{
m_model
->
m_Materials
->
m_Transparency
.
push_back
(
transparency
);
m_model
->
m_Materials
->
m_Transparency
.
push_back
(
transparency
);
}
}
}
else
if
(
strcmp
(
text
,
"shininess"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"shininess"
)
==
0
)
{
{
float
shininess
;
float
shininess
;
parseFloat
(
m_file
,
&
shininess
);
parseFloat
(
m_file
,
&
shininess
);
...
@@ -528,7 +582,8 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
...
@@ -528,7 +582,8 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
m_normalPerVertex
=
true
;
m_normalPerVertex
=
true
;
}
}
}
}
}
else
if
(
strcmp
(
text
,
"colorPerVertex"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"colorPerVertex"
)
==
0
)
{
{
GetNextTag
(
m_file
,
text
);
GetNextTag
(
m_file
,
text
);
if
(
strcmp
(
text
,
"TRUE"
)
)
if
(
strcmp
(
text
,
"TRUE"
)
)
...
@@ -540,26 +595,32 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
...
@@ -540,26 +595,32 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
colorPerVertex
=
false
;
colorPerVertex
=
false
;
}
}
}
else
if
(
strcmp
(
text
,
"Coordinate"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"Coordinate"
)
==
0
)
{
{
read_Coordinate
();
read_Coordinate
();
}
else
if
(
strcmp
(
text
,
"Normal"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"Normal"
)
==
0
)
{
{
read_Normal
();
read_Normal
();
}
else
if
(
strcmp
(
text
,
"normalIndex"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"normalIndex"
)
==
0
)
{
{
read_NormalIndex
();
read_NormalIndex
();
}
else
if
(
strcmp
(
text
,
"Color"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"Color"
)
==
0
)
{
{
read_Color
();
read_Color
();
}
else
if
(
strcmp
(
text
,
"coordIndex"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"coordIndex"
)
==
0
)
{
{
read_coordIndex
();
read_coordIndex
();
}
else
if
(
strcmp
(
text
,
"colorIndex"
)
==
0
)
}
else
if
(
strcmp
(
text
,
"colorIndex"
)
==
0
)
{
{
read_colorIndex
();
read_colorIndex
();
}
}
}
}
DBG
(
printf
(
" IndexedFaceSet failed %s
\n
"
,
text
)
);
DBG
(
printf
(
" IndexedFaceSet failed %s
\n
"
,
text
)
);
...
@@ -583,21 +644,24 @@ int VRML2_MODEL_PARSER::read_colorIndex()
...
@@ -583,21 +644,24 @@ int VRML2_MODEL_PARSER::read_colorIndex()
{
{
// it only implemented color per face, so it will store as the first in the list
// it only implemented color per face, so it will store as the first in the list
m_model
->
m_MaterialIndex
.
push_back
(
first_index
);
m_model
->
m_MaterialIndex
.
push_back
(
first_index
);
}
else
}
else
{
{
first_index
=
index
;
first_index
=
index
;
}
}
}
}
}
else
}
else
{
{
int
index
;
int
index
;
while
(
fscanf
(
m_file
,
"%d,"
,
&
index
)
)
while
(
fscanf
(
m_file
,
"%d,"
,
&
index
)
)
{
{
m_model
->
m_MaterialIndex
.
push_back
(
index
);
m_model
->
m_MaterialIndex
.
push_back
(
index
);
}
}
}
}
//DBG( printf( " m_MaterialIndex.size: %ld\n", m_model->m_MaterialIndex.size() ) );
//DBG( printf( " m_MaterialIndex.size: %ld\n", m_model->m_MaterialIndex.size() ) );
return
0
;
return
0
;
}
}
...
@@ -622,14 +686,15 @@ int VRML2_MODEL_PARSER::read_NormalIndex()
...
@@ -622,14 +686,15 @@ int VRML2_MODEL_PARSER::read_NormalIndex()
m_model
->
m_NormalIndex
.
push_back
(
coord_list
);
m_model
->
m_NormalIndex
.
push_back
(
coord_list
);
//DBG( printf( " size: %lu ", coord_list.size()) );
//DBG( printf( " size: %lu ", coord_list.size()) );
coord_list
.
clear
();
coord_list
.
clear
();
}
else
}
else
{
{
coord_list
.
push_back
(
dummy
);
coord_list
.
push_back
(
dummy
);
//DBG( printf( "%d ", dummy) );
//DBG( printf( "%d ", dummy) );
}
}
}
}
//DBG( printf( " m_NormalIndex.size: %ld\n", m_model->m_NormalIndex.size() ) );
//DBG( printf( " m_NormalIndex.size: %ld\n", m_model->m_NormalIndex.size() ) );
return
0
;
return
0
;
}
}
...
@@ -654,14 +719,15 @@ int VRML2_MODEL_PARSER::read_coordIndex()
...
@@ -654,14 +719,15 @@ int VRML2_MODEL_PARSER::read_coordIndex()
m_model
->
m_CoordIndex
.
push_back
(
coord_list
);
m_model
->
m_CoordIndex
.
push_back
(
coord_list
);
//DBG( printf( " size: %lu ", coord_list.size()) );
//DBG( printf( " size: %lu ", coord_list.size()) );
coord_list
.
clear
();
coord_list
.
clear
();
}
else
}
else
{
{
coord_list
.
push_back
(
dummy
);
coord_list
.
push_back
(
dummy
);
//DBG( printf( "%d ", dummy) );
//DBG( printf( "%d ", dummy) );
}
}
}
}
//DBG( printf( " m_CoordIndex.size: %ld\n", m_model->m_CoordIndex.size() ) );
//DBG( printf( " m_CoordIndex.size: %ld\n", m_model->m_CoordIndex.size() ) );
return
0
;
return
0
;
}
}
...
@@ -682,7 +748,7 @@ int VRML2_MODEL_PARSER::read_Color()
...
@@ -682,7 +748,7 @@ int VRML2_MODEL_PARSER::read_Color()
if
(
(
*
text
==
'}'
)
)
if
(
(
*
text
==
'}'
)
)
{
{
//DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) );
//DBG( printf( " m_DiffuseColor.size: %ld\n", m_model->m_Materials->m_DiffuseColor.size() ) );
return
0
;
return
0
;
}
}
...
@@ -693,7 +759,7 @@ int VRML2_MODEL_PARSER::read_Color()
...
@@ -693,7 +759,7 @@ int VRML2_MODEL_PARSER::read_Color()
}
}
//DBG( printf( " read_Color failed\n") );
//DBG( printf( " read_Color failed\n") );
return
-
1
;
return
-
1
;
}
}
...
@@ -714,7 +780,7 @@ int VRML2_MODEL_PARSER::read_Normal()
...
@@ -714,7 +780,7 @@ int VRML2_MODEL_PARSER::read_Normal()
if
(
(
*
text
==
'}'
)
)
if
(
(
*
text
==
'}'
)
)
{
{
//DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) );
//DBG( printf( " m_PerFaceNormalsNormalized.size: %lu\n", m_model->m_PerFaceNormalsNormalized.size() ) );
return
0
;
return
0
;
}
}
...
@@ -723,16 +789,17 @@ int VRML2_MODEL_PARSER::read_Normal()
...
@@ -723,16 +789,17 @@ int VRML2_MODEL_PARSER::read_Normal()
if
(
m_normalPerVertex
==
false
)
if
(
m_normalPerVertex
==
false
)
{
{
parseVertexList
(
m_file
,
m_model
->
m_PerFaceNormalsNormalized
);
parseVertexList
(
m_file
,
m_model
->
m_PerFaceNormalsNormalized
);
}
else
}
else
{
{
parseVertexList
(
m_file
,
m_model
->
m_PerVertexNormalsNormalized
);
parseVertexList
(
m_file
,
m_model
->
m_PerVertexNormalsNormalized
);
//DBG( printf( " m_PerVertexNormalsNormalized.size: %lu\n", m_model->m_PerVertexNormalsNormalized.size() ) );
//DBG( printf( " m_PerVertexNormalsNormalized.size: %lu\n", m_model->m_PerVertexNormalsNormalized.size() ) );
}
}
}
}
}
}
return
-
1
;
return
-
1
;
}
}
...
@@ -751,7 +818,7 @@ int VRML2_MODEL_PARSER::read_Coordinate()
...
@@ -751,7 +818,7 @@ int VRML2_MODEL_PARSER::read_Coordinate()
if
(
(
*
text
==
'}'
)
)
if
(
(
*
text
==
'}'
)
)
{
{
//DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) );
//DBG( printf( " m_Point.size: %lu\n", m_model->m_Point.size() ) );
return
0
;
return
0
;
}
}
...
@@ -761,6 +828,6 @@ int VRML2_MODEL_PARSER::read_Coordinate()
...
@@ -761,6 +828,6 @@ int VRML2_MODEL_PARSER::read_Coordinate()
}
}
}
}
return
-
1
;
return
-
1
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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