raisim::server::SceneFileServer
class · #include <raisim/server/SceneFileServer.hpp>
Internal: serves the files of a RaiSim Engine scene to a viewer.
Nested classes
structEntry — One file of the manifest.structRequest — A decoded CR_SCENE_MANIFEST (chunk = false) or CR_SCENE_FILE_CHUNK request.
Public member functions
setEnabled
void setEnabled(bool enabled)Parameters
| Parameter | Description |
|---|---|
enabled (in) | false makes every response report scene_files::kDisabled |
enabled
bool enabled() constReturns whether files are shared
invalidate
void invalidate()Re-list and re-check the files before the next manifest, e.g. for a new client, so a file edited while the server runs is hashed again. Unchanged files keep their hash.
prepare
void prepare(const rscene::Scene *scene, std::size_t byteBudget)Advance the file list of the scene: list the files once, then hash at most byteBudget bytes. Call once per frame, outside the world lock.
Parameters
| Parameter | Description |
|---|---|
scene (in) | the world's scene, or nullptr |
byteBudget (in) | most bytes to read and hash in this call |
status
scene_files::Status status() constReturns the state reported in the response header
manifestId
std::uint64_t manifestId() constReturns the manifest id (0 unless ready)
entries
const std::vector<Entry> &entries() constReturns the listed files (complete once ready)
stage
void stage(
const std::vector<Request> &requests,
std::size_t chunkBudget,
std::size_t manifestBudget=0)Stage the answers to this frame's requests, reading chunk data now so the world lock is not held during file I/O. Chunks beyond chunkBudget bytes are shortened or left out; the viewer asks again for what it did not receive. The manifest is sent once per frame within manifestBudget. Its bytes reduce the remaining chunk budget.
Parameters
| Parameter | Description |
|---|---|
requests (in) | decoded requests in arrival order |
chunkBudget (in) | most chunk bytes to send in this frame |
manifestBudget (in) | most manifest bytes to send; zero uses chunkBudget |
write
BoundedWriter write(BoundedWriter data) constWrite the scene-file block of the response header (format in SceneFileProtocol.hpp).
Parameters
| Parameter | Description |
|---|---|
data (in) | write position |
Returns the position after the block