27 #include "vrmlNodeType.h"
34 using std::istringstream;
37 extern int vrmlyyparse();
38 extern void vrmlyyResetLineNumber();
39 extern int vrmlyydebug;
40 extern int vrmlyy_flex_debug;
49 get_standard_nodes() {
50 static bool got_standard_nodes =
false;
51 static bool read_ok =
true;
52 if (got_standard_nodes) {
59 string data((
const char *)standard_nodes_data, standard_nodes_data_len);
63 istringstream inz(data);
64 IDecompressStream in(&inz,
false);
68 istringstream in(data);
71 vrml_init_parser(in,
"standardNodes.wrl");
72 if (vrmlyyparse() != 0) {
75 vrml_cleanup_parser();
77 got_standard_nodes =
true;
91 nout <<
"Cannot open " << filename <<
" for reading.\n";
105 if (!get_standard_nodes()) {
106 std::cerr <<
"Internal error--unable to parse VRML.\n";
111 VrmlNodeType::pushNameSpace();
113 vrml_init_parser(in, filename);
114 if (vrmlyyparse() == 0) {
115 scene = parsed_scene;
117 vrml_cleanup_parser();
119 VrmlNodeType::popNameSpace();
126 main(
int argc,
char *argv[]) {
128 std::cerr <<
"parse_vrml filename.wrl\n";
133 if (scene ==
nullptr) {
137 std::cout << *scene <<
"\n";
The name of a file, such as a texture file or an Egg file.
void set_text()
Indicates that the filename represents a text file.
A hierarchy of directories and files that appears to be one continuous file system,...
static void close_read_file(std::istream *stream)
Closes a file opened by a previous call to open_read_file().
std::istream * open_read_file(const Filename &filename, bool auto_unwrap) const
Convenience function; returns a newly allocated istream if the file exists and can be read,...
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
This is our own Panda specialization on the default STL vector.
VrmlScene * parse_vrml(Filename filename)
Reads the named VRML file and returns a corresponding VrmlScene, or NULL if there is a parse error.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.