Fixed for OSX.

This commit is contained in:
brunoherbelin
2020-06-02 23:12:10 +02:00
parent 80da336771
commit a3f3ff9c92
10 changed files with 48 additions and 13 deletions

View File

@@ -13,11 +13,11 @@ Frame::Frame(Type type) : Node(), type_(type), side_(nullptr), top_(nullptr), sh
color = glm::vec4( 1.f, 1.f, 1.f, 1.f);
switch (type) {
case SHARP_LARGE:
square_ = new LineSquare(color, 2.f );
square_ = new LineSquare(color, 3 );
shadow_ = new Mesh("mesh/shadow.ply", "images/shadow.png");
break;
case SHARP_THIN:
square_ = new LineSquare(color, 2.f );
square_ = new LineSquare(color, 3 );
break;
case ROUND_LARGE:
side_ = new Mesh("mesh/border_large_round.ply");

View File

@@ -250,11 +250,19 @@ void LineStrip::draw(glm::mat4 modelview, glm::mat4 projection)
if ( !initialized() )
init();
glLineWidth(linewidth_ * Rendering::manager().mainWindow().dpiScale());
// glLineWidth(linewidth_ * 2.f * Rendering::manager().mainWindow().dpiScale());
Primitive::draw(modelview, projection);
glm::mat4 mv = modelview;
glm::mat4 scale = glm::scale(glm::identity<glm::mat4>(), glm::vec3(1.001f, 1.001f, 1.f));
glLineWidth(1);
for (uint i = 0 ; i < linewidth_ ; ++i ) {
Primitive::draw(mv, projection);
mv *= scale;
}
// glLineWidth(1);
}
void LineStrip::accept(Visitor& v)

View File

@@ -176,13 +176,20 @@ bool Rendering::init()
glfwSetKeyCallback( output_.window(), WindowEscapeFullscreen);
glfwSetMouseButtonCallback( output_.window(), WindowToggleFullscreen);
return true;
}
void Rendering::show()
{
// show output window
output_.show();
// show main window
main_.show();
return true;
// show menu on first show
UserInterface::manager().showPannel();
}
bool Rendering::isActive()
@@ -520,7 +527,8 @@ bool RenderingWindow::init(int id, GLFWwindow *share)
// set position
glfwSetWindowPos(window_, winset.x, winset.y);
// window position and resize callbacks
glfwSetFramebufferSizeCallback( window_, WindowResizeCallback );
glfwSetWindowSizeCallback( window_, WindowResizeCallback );
// glfwSetFramebufferSizeCallback( window_, WindowResizeCallback );
glfwSetWindowPosCallback( window_, WindowMoveCallback );
// take opengl context ownership
@@ -577,12 +585,13 @@ bool RenderingWindow::init(int id, GLFWwindow *share)
void RenderingWindow::show()
{
glfwShowWindow(window_);
if ( Settings::application.windows[id_].fullscreen ) {
GLFWmonitor *mo = monitorNamed(Settings::application.windows[id_].monitor);
setFullscreen(mo);
}
glfwShowWindow(window_);
}
// custom surface with a new VAO

View File

@@ -94,6 +94,9 @@ public:
// Initialization OpenGL and GLFW window creation
bool init();
void show();
// true if active rendering window
bool isActive();
// draw one frame

View File

@@ -19,13 +19,15 @@
#include <ctime>
#include <algorithm>
static int global_index_ = 0;
// Node
Node::Node() : initialized_(false), visible_(true), refcount_(0)
{
// create unique id
auto duration = std::chrono::system_clock::now().time_since_epoch();
id_ = std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count() % 100000000;
// auto duration = std::chrono::high_resolution_clock::now().time_since_epoch();
// id_ = std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count() % 100000000;
id_ = global_index_ < INT_MAX ? global_index_++ : 0;
transform_ = glm::identity<glm::mat4>();
scale_ = glm::vec3(1.f);

View File

@@ -4,7 +4,10 @@
SearchVisitor::SearchVisitor(Node *node) : Visitor(), node_(node), id_(0), found_(false)
{
id_ = node->id();
if (node != nullptr)
id_ = node->id();
else
id_ = -1;
}
SearchVisitor::SearchVisitor(int id) : Visitor(), node_(nullptr), id_(id), found_(false)

View File

@@ -224,6 +224,9 @@ FrameBuffer *Source::frame() const
bool Source::contains(Node *node) const
{
if ( node == nullptr )
return false;
hasNode tester(node);
return tester(this);
}

View File

@@ -901,10 +901,13 @@ void UserInterface::RenderShaderEditor()
}
void UserInterface::showPannel()
{
navigator.showPannelSource(Mixer::manager().indexCurrentSource());
int s = Mixer::manager().indexCurrentSource();
if (s > -1)
navigator.showPannelSource(s);
else
navigator.togglePannelMenu();
}
Navigator::Navigator()

View File

@@ -106,6 +106,7 @@ MixingView::MixingView() : View(MIXING)
// no settings found: store application default
Settings::application.views[mode_].name = "Mixing";
scene.root()->scale_ = glm::vec3(2.4f, 2.4f, 1.0f);
scene.root()->translation_ = glm::vec3(1.0f, 0.0f, 0.0f);
saveSettings();
}

View File

@@ -73,6 +73,9 @@ int main(int, char**)
// draw the scene
Rendering::manager().pushFrontDrawCallback(drawScene);
// show all windows
Rendering::manager().show();
///
/// Main LOOP
///