Panda3D
Loading...
Searching...
No Matches
loaderFileTypeSrt.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 loaderFileTypeSrt.cxx
10 * @author drose
11 * @date 2010-10-06
12 */
13
14#include "loaderFileTypeSrt.h"
15#include "speedTreeNode.h"
16#include "stTree.h"
17
18TypeHandle LoaderFileTypeSrt::_type_handle;
19
20/**
21 *
22 */
23LoaderFileTypeSrt::
24LoaderFileTypeSrt() {
25}
26
27/**
28 *
29 */
30std::string LoaderFileTypeSrt::
31get_name() const {
32 return "SpeedTree compiled tree";
33}
34
35/**
36 *
37 */
38std::string LoaderFileTypeSrt::
39get_extension() const {
40 return "srt";
41}
42
43/**
44 * Returns true if this file type can transparently load compressed files
45 * (with a .pz or .gz extension), false otherwise.
46 */
48supports_compressed() const {
49 return false;
50}
51
52/**
53 *
54 */
55PT(PandaNode) LoaderFileTypeSrt::
56load_file(const Filename &path, const LoaderOptions &,
57 BamCacheRecord *record) const {
58 if (!path.is_regular_file()) {
59 // Quietly fail if the file doesn't exist. The Loader expects this.
60 return nullptr;
61 }
62
63 PT(STTree) tree = new STTree(path);
64 if (!tree->is_valid()) {
65 return nullptr;
66 }
67
68 PT(SpeedTreeNode) st = new SpeedTreeNode(path.get_basename());
69 st->add_instance(tree, STTransform());
70
71 return st;
72}
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
Represents a transform that may be applied to a particular instance of a tree when added to the Speed...
Definition stTransform.h:26
Encapsulates a single tree model in the SpeedTree library, as loaded from an SRT file.
Definition stTree.h:28
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.