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
cb91e095
Commit
cb91e095
authored
Aug 16, 2014
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding policy fixes and comment out debugging output.
parent
5f70ec63
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
394 additions
and
369 deletions
+394
-369
vrml_aux.cpp
3d-viewer/vrml_aux.cpp
+63
-56
vrml_v1_modelparser.cpp
3d-viewer/vrml_v1_modelparser.cpp
+84
-78
vrml_v2_modelparser.cpp
3d-viewer/vrml_v2_modelparser.cpp
+145
-140
vrmlmodelparser.cpp
3d-viewer/vrmlmodelparser.cpp
+8
-7
x3dmodelparser.cpp
3d-viewer/x3dmodelparser.cpp
+94
-88
No files found.
3d-viewer/vrml_aux.cpp
View file @
cb91e095
...
@@ -28,65 +28,63 @@
...
@@ -28,65 +28,63 @@
#include "vrml_aux.h"
#include "vrml_aux.h"
char
SkipGetChar
(
FILE
*
File
)
char
SkipGetChar
(
FILE
*
File
)
{
{
char
c
;
char
c
;
bool
re_parse
;
bool
re_parse
;
if
(
(
c
=
fgetc
(
File
)
)
==
EOF
)
if
(
(
c
=
fgetc
(
File
)
)
==
EOF
)
{
{
//DBG( printf( "EOF\n" ) );
//
DBG( printf( "EOF\n" ) );
return
EOF
;
return
EOF
;
}
}
//DBG( printf( "c %c 0x%02X\n", c, c ) );
//
DBG( printf( "c %c 0x%02X\n", c, c ) );
do
do
{
{
re_parse
=
false
;
re_parse
=
false
;
if
((
c
==
' '
)
||
(
c
==
'\t'
)
||
(
c
==
'{'
)
||
(
c
==
'['
)
)
if
(
(
c
==
' '
)
||
(
c
==
'\t'
)
||
(
c
==
'{'
)
||
(
c
==
'['
)
)
{
{
//DBG( printf( "Skipping space \\t or { or [\n" ) );
//
DBG( printf( "Skipping space \\t or { or [\n" ) );
do
do
{
{
if
(
(
c
=
fgetc
(
File
)
)
==
EOF
)
if
(
(
c
=
fgetc
(
File
)
)
==
EOF
)
{
{
//
DBG( printf( "EOF\n" ) );
//
DBG( printf( "EOF\n" ) );
return
EOF
;
return
EOF
;
}
}
}
}
while
(
(
c
==
' '
)
||
(
c
==
'\t'
)
||
(
c
==
'{'
)
||
(
c
==
'['
)
);
while
((
c
==
' '
)
||
(
c
==
'\t'
)
||
(
c
==
'{'
)
||
(
c
==
'['
));
}
}
if
((
c
==
'#'
)
||
(
c
==
'\n'
)
||
(
c
==
'\r'
)
||
(
c
==
0
)
||
(
c
==
','
)
)
if
(
(
c
==
'#'
)
||
(
c
==
'\n'
)
||
(
c
==
'\r'
)
||
(
c
==
0
)
||
(
c
==
','
)
)
{
{
if
(
c
==
'#'
)
if
(
c
==
'#'
)
{
{
//DBG( printf( "Skipping # \\n or \\r or 0, 0x%02X\n", c ) );
//
DBG( printf( "Skipping # \\n or \\r or 0, 0x%02X\n", c ) );
do
do
{
{
if
(
(
c
=
fgetc
(
File
)
)
==
EOF
)
if
(
(
c
=
fgetc
(
File
)
)
==
EOF
)
{
{
//DBG( printf( "EOF\n" ) );
//
DBG( printf( "EOF\n" ) );
return
EOF
;
return
EOF
;
}
}
}
}
while
(
(
c
!=
'\n'
)
&&
(
c
!=
'\r'
)
&&
(
c
!=
0
)
&&
(
c
!=
','
)
);
while
((
c
!=
'\n'
)
&&
(
c
!=
'\r'
)
&&
(
c
!=
0
)
&&
(
c
!=
','
));
}
}
else
else
{
{
if
(
(
c
=
fgetc
(
File
)
)
==
EOF
)
if
(
(
c
=
fgetc
(
File
)
)
==
EOF
)
{
{
//DBG( printf( "EOF\n" ) );
//
DBG( printf( "EOF\n" ) );
return
EOF
;
return
EOF
;
}
}
}
}
re_parse
=
true
;
re_parse
=
true
;
}
}
}
while
(
re_parse
==
true
);
}
while
(
re_parse
==
true
);
return
c
;
return
c
;
}
}
...
@@ -94,35 +92,38 @@ char SkipGetChar ( FILE* File )
...
@@ -94,35 +92,38 @@ char SkipGetChar ( FILE* File )
char
*
GetNextTag
(
FILE
*
File
,
char
*
tag
)
char
*
GetNextTag
(
FILE
*
File
,
char
*
tag
)
{
{
char
c
=
SkipGetChar
(
File
);
char
c
=
SkipGetChar
(
File
);
if
(
c
==
EOF
)
if
(
c
==
EOF
)
{
{
return
NULL
;
return
NULL
;
}
}
tag
[
0
]
=
c
;
tag
[
1
]
=
0
;
tag
[
0
]
=
c
;
//DBG( printf( "tag[0] %c\n", tag[0] ) );
tag
[
1
]
=
0
;
// DBG( printf( "tag[0] %c\n", tag[0] ) );
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
==
'{'
)
||
if
(
(
*
dst
==
' '
)
||
(
*
dst
==
'['
)
||
(
*
dst
==
'{'
)
(
*
dst
==
'\t'
)
||
(
*
dst
==
'\n'
)
||
(
*
dst
==
'\r'
)
)
||
(
*
dst
==
'\t'
)
||
(
*
dst
==
'\n'
)
||
(
*
dst
==
'\r'
)
)
{
{
*
dst
=
0
;
*
dst
=
0
;
break
;
break
;
}
}
dst
++
;
dst
++
;
}
}
//DBG( printf( "tag %s\n", tag ) );
//
DBG( printf( "tag %s\n", tag ) );
c
=
SkipGetChar
(
File
);
c
=
SkipGetChar
(
File
);
if
(
c
!=
EOF
)
if
(
c
!=
EOF
)
{
{
// Puts again the read char in the buffer
// Puts again the read char in the buffer
ungetc
(
c
,
File
);
ungetc
(
c
,
File
);
...
@@ -133,40 +134,44 @@ char* GetNextTag( FILE* File, char* tag )
...
@@ -133,40 +134,44 @@ char* GetNextTag( FILE* File, char* tag )
}
}
int
read_NotImplemented
(
FILE
*
File
,
char
closeChar
)
int
read_NotImplemented
(
FILE
*
File
,
char
closeChar
)
{
{
char
c
;
char
c
;
//DBG( printf( "look for %c\n", closeChar) );
while
(
(
c
=
fgetc
(
File
))
!=
EOF
)
// DBG( printf( "look for %c\n", closeChar) );
while
(
(
c
=
fgetc
(
File
)
)
!=
EOF
)
{
{
if
(
c
==
'{'
)
if
(
c
==
'{'
)
{
{
//DBG( printf( "{\n") );
//
DBG( printf( "{\n") );
read_NotImplemented
(
File
,
'}'
);
read_NotImplemented
(
File
,
'}'
);
}
else
if
(
c
==
'['
)
}
else
if
(
c
==
'['
)
{
{
//DBG( printf( "[\n") );
//
DBG( printf( "[\n") );
read_NotImplemented
(
File
,
']'
);
read_NotImplemented
(
File
,
']'
);
}
else
if
(
c
==
closeChar
)
}
else
if
(
c
==
closeChar
)
{
{
//DBG( printf( "%c\n", closeChar) );
//
DBG( printf( "%c\n", closeChar) );
return
0
;
return
0
;
}
}
}
}
DBG
(
printf
(
" NotImplemented failed
\n
"
)
);
//
DBG( printf( " NotImplemented failed\n" ) );
return
-
1
;
return
-
1
;
}
}
int
parseVertexList
(
FILE
*
File
,
std
::
vector
<
glm
::
vec3
>
&
dst_vector
)
int
parseVertexList
(
FILE
*
File
,
std
::
vector
<
glm
::
vec3
>&
dst_vector
)
{
{
//DBG( printf( " parseVertexList\n" ) );
//
DBG( printf( " parseVertexList\n" ) );
dst_vector
.
clear
();
dst_vector
.
clear
();
glm
::
vec3
vertex
;
glm
::
vec3
vertex
;
while
(
parseVertex
(
File
,
vertex
)
==
3
)
while
(
parseVertex
(
File
,
vertex
)
==
3
)
{
{
dst_vector
.
push_back
(
vertex
);
dst_vector
.
push_back
(
vertex
);
}
}
...
@@ -175,32 +180,34 @@ int parseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector)
...
@@ -175,32 +180,34 @@ int parseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector)
}
}
int
parseVertex
(
FILE
*
File
,
glm
::
vec3
&
dst_vertex
)
int
parseVertex
(
FILE
*
File
,
glm
::
vec3
&
dst_vertex
)
{
{
float
a
,
b
,
c
;
float
a
,
b
,
c
;
int
ret
=
fscanf
(
File
,
"%e %e %e"
,
&
a
,
&
b
,
&
c
);
int
ret
=
fscanf
(
File
,
"%e %e %e"
,
&
a
,
&
b
,
&
c
);
dst_vertex
.
x
=
a
;
dst_vertex
.
x
=
a
;
dst_vertex
.
y
=
b
;
dst_vertex
.
y
=
b
;
dst_vertex
.
z
=
c
;
dst_vertex
.
z
=
c
;
char
s
=
SkipGetChar
(
File
);
char
s
=
SkipGetChar
(
File
);
if
(
s
!=
EOF
)
if
(
s
!=
EOF
)
{
{
// Puts again the read char in the buffer
// Puts again the read char in the buffer
ungetc
(
s
,
File
);
ungetc
(
s
,
File
);
}
}
//DBG( printf( "ret%d(%.9f,%.9f,%.9f)", ret, a,b,c) );
// DBG( printf( "ret%d(%.9f,%.9f,%.9f)", ret, a,b,c) );
return
ret
;
return
ret
;
}
}
int
parseFloat
(
FILE
*
File
,
float
*
dst_float
)
int
parseFloat
(
FILE
*
File
,
float
*
dst_float
)
{
{
float
value
;
float
value
;
int
ret
=
fscanf
(
File
,
"%e"
,
&
value
);
int
ret
=
fscanf
(
File
,
"%e"
,
&
value
);
*
dst_float
=
value
;
*
dst_float
=
value
;
return
ret
;
return
ret
;
...
...
3d-viewer/vrml_v1_modelparser.cpp
View file @
cb91e095
This diff is collapsed.
Click to expand it.
3d-viewer/vrml_v2_modelparser.cpp
View file @
cb91e095
This diff is collapsed.
Click to expand it.
3d-viewer/vrmlmodelparser.cpp
View file @
cb91e095
...
@@ -76,20 +76,21 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -76,20 +76,21 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
if
(
fgets
(
line
,
11
,
file
)
==
NULL
)
if
(
fgets
(
line
,
11
,
file
)
==
NULL
)
{
{
fclose
(
file
);
fclose
(
file
);
return
;
return
;
}
}
fclose
(
file
);
fclose
(
file
);
if
(
stricmp
(
line
,
"#VRML V2.0"
)
==
0
)
if
(
stricmp
(
line
,
"#VRML V2.0"
)
==
0
)
{
{
//DBG( printf( "About to parser a #VRML V2.0 file\n" ) );
//DBG( printf( "About to parser a #VRML V2.0 file\n" ) );
vrml2_parser
->
Load
(
aFilename
);
vrml2_parser
->
Load
(
aFilename
);
return
;
return
;
}
}
else
if
(
stricmp
(
line
,
"#VRML V1.0"
)
==
0
)
else
if
(
stricmp
(
line
,
"#VRML V1.0"
)
==
0
)
{
{
//DBG( printf( "About to parser a #VRML V1.0 file\n" ) );
//DBG( printf( "About to parser a #VRML V1.0 file\n" ) );
vrml1_parser
->
Load
(
aFilename
);
vrml1_parser
->
Load
(
aFilename
);
...
@@ -97,5 +98,5 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
...
@@ -97,5 +98,5 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
return
;
return
;
}
}
DBG
(
printf
(
"Unknown VRML file format: %s
\n
"
,
line
)
);
//
DBG( printf( "Unknown VRML file format: %s\n", line ) );
}
}
3d-viewer/x3dmodelparser.cpp
View file @
cb91e095
This diff is collapsed.
Click to expand it.
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