Panda3D
Loading...
Searching...
No Matches
loaderFileTypeStf.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file loaderFileTypeStf.cxx
10 * @author drose
11 * @date 2010-10-06
12 */
13
14#include "loaderFileTypeStf.h"
15#include "speedTreeNode.h"
16
17TypeHandle LoaderFileTypeStf::_type_handle;
18
19/**
20 *
21 */
22LoaderFileTypeStf::
23LoaderFileTypeStf() {
24}
25
26/**
27 *
28 */
29std::string LoaderFileTypeStf::
30get_name() const {
31 return "SpeedTree compiled tree";
32}
33
34/**
35 *
36 */
37std::string LoaderFileTypeStf::
38get_extension() const {
39 return "stf";
40}
41
42/**
43 * Returns true if this file type can transparently load compressed files
44 * (with a .pz or .gz extension), false otherwise.
45 */
47supports_compressed() const {
48 return true;
49}
50
51/**
52 *
53 */
54PT(PandaNode) LoaderFileTypeStf::
55load_file(const Filename &path, const LoaderOptions &options,
56 BamCacheRecord *record) const {
57 if (!path.is_regular_file()) {
58 // Quietly fail if the file doesn't exist. The Loader expects this.
59 return nullptr;
60 }
61
62 PT(SpeedTreeNode) st = new SpeedTreeNode(path.get_basename());
63 st->add_from_stf(path, options);
64
65 return st;
66}
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
bool is_regular_file() const
Returns true if the filename exists on the physical disk and is the name of a regular file (i....
std::string get_basename() const
Returns the basename part of the filename.
Definition filename.I:367
virtual bool supports_compressed() const
Returns true if this file type can transparently load compressed files (with a .pz or ....
Specifies parameters that may be passed to the loader.
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
Interfaces with the SpeedTree library to render SpeedTree objects, especially trees,...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.