Enzo
Loading...
Searching...
No Matches
CookContext.h
1#pragma once
2
3#include "Engine/Core/Types.h"
4#include "Engine/Network/NodePacket.h"
5
6namespace enzo::nt {
7class NetworkManager;
8}
9
10namespace enzo::prm {
11class Ramp;
12}
13
14namespace enzo::nt {
23{
24 public:
26
28 enzo::nt::NodeId getNodeId() const { return nodeId_; }
29 enzo::NodePacket cloneInputPacket(unsigned int inputIndex);
30
32 std::shared_ptr<const enzo::NodePacket> getInputPacket(unsigned int inputIndex);
33 bool hasInput(unsigned int inputIndex);
34 unsigned int getInputCount();
35
38 floatT getFrame() const;
39
41 floatT getTime() const;
42
43 floatT evalParmFloat(std::string_view parmName, const unsigned int index = 0) const;
44 intT evalParmInt(std::string_view parmName, const unsigned int index = 0) const;
45 boolT evalParmBool(std::string_view parmName, const unsigned int index = 0) const;
46 String evalParmString(std::string_view parmName, const unsigned int index = 0) const;
47
48 // Read every value of a parameter as a list. The singular forms above read
49 // one value by index, these read them all at once.
50 std::vector<floatT> evalParmFloats(std::string_view parmName) const;
51 std::vector<intT> evalParmInts(std::string_view parmName) const;
52 std::vector<String> evalParmStrings(std::string_view parmName) const;
53
54 // Read the first two float components of a parameter as a Vector2. Missing
55 // components default to zero.
56 Vector2 evalParmVector2(std::string_view parmName) const;
57
58 // Read the first three float components of a parameter as a Vector3. Missing
59 // components default to zero.
60 Vector3 evalParmVector3(std::string_view parmName) const;
61
62 // Snapshot a ramp parameter into a sampler for use during cook.
63 enzo::prm::Ramp evalParmRamp(std::string_view parmName) const;
64
65 private:
67 void recordTimeDependency_() const;
68
69 enzo::nt::NodeId nodeId_;
70 enzo::nt::NetworkManager& networkManager_;
71};
72} // namespace enzo::nt
Basic attribute, parameter, and node types for Enzo.
uint64_t NodeId
The unique ID assigned to each node in the network.
Definition Types.h:335
Definition NodePacket.h:12
The handle a node holds while it cooks to get context about the network.
Definition CookContext.h:23
floatT getTime() const
Returns the scene time in seconds, measured from the start of frame 1.
Definition CookContext.cpp:49
floatT getFrame() const
Returns the frame the scene sits on.
Definition CookContext.cpp:43
std::shared_ptr< const enzo::NodePacket > getInputPacket(unsigned int inputIndex)
Returns the geometry arriving at an input, read only.
Definition CookContext.cpp:21
enzo::nt::NodeId getNodeId() const
Returns the id of the node being cooked.
Definition CookContext.h:28
The central coordinator of the engine's node system.
Definition NetworkManager.h:31
A sampled snapshot of a ramp parameter read during cook.
Definition Ramp.h:25