40 #ifndef H_OGF_GRAPHITE_LUAGROB_LUA_GROB_H
41 #define H_OGF_GRAPHITE_LUAGROB_LUA_GROB_H
47 typedef int lua_State;
50 #include <geogram/third_party/lua/lua.h>
83 return !lua_error_occured_;
95 bool get_autorun()
const {
131 shader_source_ = source;
132 execute_shader_program();
140 return shader_source_;
151 void execute_program();
254 lua_State* lua_shader_state_;
255 bool lua_error_occured_;
259 std::string shader_source_;
A Composite Graphite Object.
Base class for all 3D Graphite objects.
A Grob class for luagrob grids.
bool serialize_read(InputGraphiteFile &geofile) override
Reads this Grob from a GeoFile.
void execute_shader_program()
Executes the loaded LUA shader program.
const std::string & get_shader_source() const
Gets the source of the LUA shader program.
static LuaGrob * find_or_create(SceneGraph *sg, const std::string &name)
Finds or creates a LuaGrob with the specified name.
void set_shader_source(const std::string &source)
Sets the source of the LUA shader program and executes it.
bool shader_OK() const
Tests the status of the loaded LUA program.
void load_program_source(const std::string &value)
Loads the LUA program from a file.
void set_autorun(bool x)
Sets whether the source should be executed automatically when the object is loaded.
void load_shader_source(const std::string &value)
Loads the LUA shader program from a file.
bool serialize_write(OutputGraphiteFile &geofile) override
Writes this Grob into a stream.
void save_shader_source(const std::string &value)
Saves the LUA shader program to a file.
const std::string & get_source() const
Gets the source of the LUA program.
LuaGrob(CompositeGrob *parent)
LuaGrob constructor.
void set_box(const Box3d &box)
Sets the bounding box.
bool execute_shader_command(const std::string &value)
Executes a LUA command in the interpreter used for the shader.
void set_source(const std::string &source)
Sets the source of the LUA program.
Box3d bbox() const override
Gets the bounding box.
Grob * duplicate(SceneGraph *sg) override
Duplicates this Grob.
~LuaGrob() override
LuaGrob destructor.
void save_program_source(const std::string &value)
Saves the LUA program to a file.
static LuaGrob * find(SceneGraph *sg, const std::string &name)
Finds a LuaGrob by name.
void clear() override
Clears this Grob.
bool is_serializable() const override
Tests whether this Grob can be serialized in GeoFile.
A template class for strings that need to have a specific type in the GOM system.
An extension of InputGeoFile for storing a complete Graphite scenegraph in a structured binary file.
Represents the list of objects loaded in Graphite.
The base class for all 3D objects in the system.
Global Graphite namespace.
Name< LuaGrob * > LuaGrobName
The name of an existing LuaGrob in the SceneGraph.
Name< LuaGrob *, true > NewLuaGrobName
The name of an (existing or not) LuaGrob in the SceneGraph.
Definitions common to all include files in the luagrob library.