23 PhysxFileStream::PhysxFileStream(
const Filename &fn,
bool load) : _fp(nullptr), _vf(nullptr), _in(nullptr)
27 _in = _vf->open_read_file(
true);
30 _fp = fopen(fn.c_str(),
"wb");
37 PhysxFileStream::~PhysxFileStream()
40 if (_vf) _vf->close_read_file(_in);
46 NxU8 PhysxFileStream::readByte()
const 49 _in->read((
char *)&b,
sizeof(NxU8));
50 NX_ASSERT(!(_in->bad()));
57 NxU16 PhysxFileStream::readWord()
const 60 _in->read((
char *)&w,
sizeof(NxU16));
61 NX_ASSERT(!(_in->bad()));
68 NxU32 PhysxFileStream::readDword()
const 71 _in->read((
char *)&d,
sizeof(NxU32));
72 NX_ASSERT(!(_in->bad()));
79 float PhysxFileStream::readFloat()
const 82 _in->read((
char *)&f,
sizeof(NxReal));
83 NX_ASSERT(!(_in->bad()));
90 double PhysxFileStream::readDouble()
const 93 _in->read((
char *)&f,
sizeof(NxF64));
94 NX_ASSERT(!(_in->bad()));
101 void PhysxFileStream::readBuffer(
void *buffer, NxU32 size)
const 103 _in->read((
char *)buffer, size);
104 NX_ASSERT(!(_in->bad()));
110 NxStream &PhysxFileStream::storeByte(NxU8 b)
112 size_t w = fwrite(&b,
sizeof(NxU8), 1, _fp);
120 NxStream &PhysxFileStream::storeWord(NxU16 w)
122 size_t ww = fwrite(&w,
sizeof(NxU16), 1, _fp);
130 NxStream &PhysxFileStream::storeDword(NxU32 d)
132 size_t w = fwrite(&d,
sizeof(NxU32), 1, _fp);
140 NxStream &PhysxFileStream::storeFloat(NxReal f)
142 size_t w = fwrite(&f,
sizeof(NxReal), 1, _fp);
150 NxStream &PhysxFileStream::storeDouble(NxF64 f)
152 size_t w = fwrite(&f,
sizeof(NxF64), 1, _fp);
160 NxStream &PhysxFileStream::storeBuffer(
const void *buffer, NxU32 size)
162 size_t w = fwrite(buffer, size, 1, _fp);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
The name of a file, such as a texture file or an Egg file.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
PointerTo< VirtualFile > get_file(const Filename &filename, bool status_only=false) const
Looks up the file by the indicated name in the file system.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.