mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-29 15:29:26 -05:00
Merge branch 'feature/cef-update' into thesis/2021/skybrowser
This commit is contained in:
@@ -339,7 +339,8 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
|
||||
|
||||
ghoul::opengl::TextureUnit unit;
|
||||
unit.activate();
|
||||
_texture->bind();
|
||||
bindTexture();
|
||||
defer{ unbindTexture(); };
|
||||
_shader->setUniform(_uniformCache.colorTexture, unit);
|
||||
|
||||
// Setting these states should not be necessary,
|
||||
@@ -390,6 +391,12 @@ void RenderableSphere::update(const UpdateData&) {
|
||||
}
|
||||
}
|
||||
|
||||
void RenderableSphere::bindTexture() {
|
||||
_texture->bind();
|
||||
}
|
||||
|
||||
void RenderableSphere::unbindTexture() {}
|
||||
|
||||
void RenderableSphere::loadTexture() {
|
||||
if (!_texturePath.value().empty()) {
|
||||
std::unique_ptr<ghoul::opengl::Texture> texture =
|
||||
|
||||
@@ -60,6 +60,10 @@ public:
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
protected:
|
||||
virtual void bindTexture();
|
||||
virtual void unbindTexture();
|
||||
|
||||
private:
|
||||
void loadTexture();
|
||||
|
||||
|
||||
@@ -136,18 +136,8 @@ scripting::LuaLibrary ScreenSpaceDashboard::luaLibrary() {
|
||||
return {
|
||||
"dashboard",
|
||||
{
|
||||
{
|
||||
"addDashboardItemToScreenSpace",
|
||||
&luascriptfunctions::addDashboardItemToScreenSpace,
|
||||
"string, table",
|
||||
"Adds a new dashboard item to an existing SceenSpaceDashboard."
|
||||
},
|
||||
{
|
||||
"removeDashboardItemsFromScreenSpace",
|
||||
&luascriptfunctions::removeDashboardItemsFromScreenSpace,
|
||||
"string",
|
||||
"Removes all dashboard items from an existing ScreenSpaceDashboard."
|
||||
}
|
||||
codegen::lua::AddDashboardItemToScreenSpace,
|
||||
codegen::lua::RemoveDashboardItemsFromScreenSpace
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -22,56 +22,48 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
namespace openspace::luascriptfunctions {
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* addDashboardItemToScreenSpace(string, table):
|
||||
*/
|
||||
int addDashboardItemToScreenSpace(lua_State* L) {
|
||||
ghoul::lua::checkArgumentsAndThrow(L, 2, "lua::addDashboardItemToScreenSpace");
|
||||
auto [name, d] = ghoul::lua::values<std::string, ghoul::Dictionary>(L);
|
||||
//Adds a new dashboard item to an existing SceenSpaceDashboard.
|
||||
[[codegen::luawrap]] void addDashboardItemToScreenSpace(std::string identifier,
|
||||
ghoul::Dictionary dashboard)
|
||||
{
|
||||
using namespace openspace;
|
||||
|
||||
ScreenSpaceRenderable* ssr = global::renderEngine->screenSpaceRenderable(name);
|
||||
ScreenSpaceRenderable* ssr = global::renderEngine->screenSpaceRenderable(identifier);
|
||||
if (!ssr) {
|
||||
return ghoul::lua::luaError(L, "Provided name is not a ScreenSpace item");
|
||||
throw ghoul::lua::LuaError("Provided name is not a ScreenSpace item");
|
||||
}
|
||||
|
||||
ScreenSpaceDashboard* dash = dynamic_cast<ScreenSpaceDashboard*>(ssr);
|
||||
if (!dash) {
|
||||
return ghoul::lua::luaError(
|
||||
L,
|
||||
throw ghoul::lua::LuaError(
|
||||
"Provided name is a ScreenSpace item but not a dashboard"
|
||||
);
|
||||
}
|
||||
|
||||
dash->dashboard().addDashboardItem(DashboardItem::createFromDictionary(d));
|
||||
return 0;
|
||||
dash->dashboard().addDashboardItem(DashboardItem::createFromDictionary(dashboard));
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup LuaScripts
|
||||
* removeDashboardItemsFromScreenSpace(string):
|
||||
*/
|
||||
int removeDashboardItemsFromScreenSpace(lua_State* L) {
|
||||
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::removeDashboardItemsFromScreenSpace");
|
||||
const std::string name = ghoul::lua::value<std::string>(L);
|
||||
// Removes all dashboard items from an existing ScreenSpaceDashboard.
|
||||
[[codegen::luawrap]] void removeDashboardItemsFromScreenSpace(std::string identifier) {
|
||||
using namespace openspace;
|
||||
|
||||
ScreenSpaceRenderable* ssr = global::renderEngine->screenSpaceRenderable(name);
|
||||
ScreenSpaceRenderable* ssr = global::renderEngine->screenSpaceRenderable(identifier);
|
||||
if (!ssr) {
|
||||
return ghoul::lua::luaError(L, "Provided name is not a ScreenSpace item");
|
||||
throw ghoul::lua::LuaError("Provided identifier is not a ScreenSpace item");
|
||||
}
|
||||
|
||||
ScreenSpaceDashboard* dash = dynamic_cast<ScreenSpaceDashboard*>(ssr);
|
||||
if (!dash) {
|
||||
return ghoul::lua::luaError(
|
||||
L,
|
||||
"Provided name is a ScreenSpace item but not a dashboard"
|
||||
throw ghoul::lua::LuaError(
|
||||
"Provided identifier is a ScreenSpace item but not a dashboard"
|
||||
);
|
||||
}
|
||||
|
||||
dash->dashboard().clearDashboardItems();
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace openspace::luascriptfunctions
|
||||
#include "screenspacedashboard_lua_codegen.cpp"
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user