Public variables are accessible as CG parameters and by the parent scene when nested inside another.
There are some variables that are always defined like
"frame" which stores the number of frames that have gone by since the scene producer started,
- "mouse_x" and "mouse_y" which reflect the X and Y position of the mouse at all times relative to the scene coordinate system (requires interaction aware consumer like screen_consumer) and
- "timeline_frame" which differs from "frame" in that it can rewind and jump, depending on where the timeline is at the moment.
+ "mouse_x" and "mouse_y" which reflect the X and Y position of the mouse at all times relative to the scene coordinate system (requires interaction aware consumer like screen_consumer),
+ "timeline_frame" which differs from "frame" in that it can rewind and jump, depending on where the timeline is at the moment and
+ "scene_width" and "scene_height" which contains the dimensions of the scene coordinate system.
</xs:documentation>
</xs:annotation>
<xs:complexType>
impl(std::wstring producer_name, int width, int height, const video_format_desc& format_desc)
: producer_name_(std::move(producer_name))
- , pixel_constraints_(width, height)
, format_desc_(format_desc)
, aggregator_([=] (double x, double y) { return collission_detect(x, y); })
{
mouse_y_ = mouse_y_variable->value();
m_x_ = 0;
m_y_ = 0;
+
+ auto scene_width = std::make_shared<core::variable_impl<double>>(boost::lexical_cast<std::wstring>(width), false, width);
+ auto scene_height = std::make_shared<core::variable_impl<double>>(boost::lexical_cast<std::wstring>(height), false, height);
+ store_variable(L"scene_width", scene_width);
+ store_variable(L"scene_height", scene_height);
+ pixel_constraints_.width = scene_width->value();
+ pixel_constraints_.height = scene_height->value();
}
layer& create_layer(