mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
day-night loop, dynamic skybox, clock on debug panel
This commit is contained in:
parent
4a9a4ddd14
commit
c08c31b0ad
24 changed files with 599 additions and 48 deletions
|
|
@ -42,11 +42,16 @@ mat4 Camera::getProjection(){
|
|||
return glm::ortho(0.0f, fov*aspect, 0.0f, fov);
|
||||
}
|
||||
|
||||
mat4 Camera::getView(){
|
||||
if (perspective)
|
||||
mat4 Camera::getView(bool pos){
|
||||
vec3 position = this->position;
|
||||
if (!pos) {
|
||||
position = vec3(0.0f);
|
||||
}
|
||||
if (perspective) {
|
||||
return glm::lookAt(position, position+front, up);
|
||||
else
|
||||
} else {
|
||||
return glm::translate(glm::mat4(1.0f), position);
|
||||
}
|
||||
}
|
||||
|
||||
mat4 Camera::getProjView(){
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public:
|
|||
void rotate(float x, float y, float z);
|
||||
|
||||
mat4 getProjection();
|
||||
mat4 getView();
|
||||
mat4 getView(bool position=true);
|
||||
mat4 getProjView();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,10 @@ int Window::initialize(DisplaySettings& settings){
|
|||
glfwSetWindowMonitor(window, monitor, 0, 0, mode->width, mode->height, GLFW_DONT_CARE);
|
||||
}
|
||||
glfwSwapInterval(settings.swapInterval);
|
||||
const GLubyte* vendor = glGetString(GL_VENDOR);
|
||||
const GLubyte* renderer = glGetString(GL_RENDERER);
|
||||
std::cout << "GL Vendor: " << (char*)vendor << std::endl;
|
||||
std::cout << "GL Renderer: " << (char*)renderer << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -134,6 +138,10 @@ void Window::clear() {
|
|||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void Window::clearDepth() {
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
void Window::setBgColor(glm::vec3 color) {
|
||||
glClearColor(color.r, color.g, color.b, 1.0f);
|
||||
}
|
||||
|
|
@ -252,6 +260,7 @@ DisplaySettings* Window::getSettings() {
|
|||
|
||||
ImageData* Window::takeScreenshot() {
|
||||
ubyte* data = new ubyte[width * height * 3];
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, data);
|
||||
return new ImageData(ImageFormat::rgb888, width, height, data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public:
|
|||
static void resetScissor();
|
||||
|
||||
static void clear();
|
||||
static void clearDepth();
|
||||
static void setBgColor(glm::vec3 color);
|
||||
static double time();
|
||||
static DisplaySettings* getSettings();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue