24 #include "pandatoolbase.h"
26 #include "parse_vrml.h"
27 #include "vrmlParserDefs.h"
28 #include "vrmlNodeType.h"
30 #include "standard_nodes.h"
32 #include "virtualFileSystem.h"
34 extern int vrmlyyparse();
35 extern void vrmlyyResetLineNumber();
36 extern int vrmlyydebug;
37 extern int vrmlyy_flex_debug;
47 get_standard_nodes() {
48 static bool got_standard_nodes =
false;
49 static bool read_ok =
true;
50 if (got_standard_nodes) {
57 string data((
const char *)standard_nodes_data, standard_nodes_data_len);
62 IDecompressStream in(&inz,
false);
69 vrml_init_parser(in,
"standardNodes.wrl");
70 if (vrmlyyparse() != 0) {
73 vrml_cleanup_parser();
75 got_standard_nodes =
true;
89 if (in == (istream *)NULL) {
90 nout <<
"Cannot open " << filename <<
" for reading.\n";
93 VrmlScene *result = parse_vrml(*in, filename);
104 parse_vrml(istream &in,
const string &filename) {
105 if (!get_standard_nodes()) {
106 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 cerr <<
"parse_vrml filename.wrl\n";
137 cout << *scene <<
"\n";
A hierarchy of directories and files that appears to be one continuous file system, even though the files may originate from several different sources that may not be related to the actual OS's file system.
void set_text()
Indicates that the filename represents a text file.
static void close_read_file(istream *stream)
Closes a file opened by a previous call to open_read_file().
This is our own Panda specialization on the default STL vector.
The name of a file, such as a texture file or an Egg file.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
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...