This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c), Recep Aslantas. All rights reserved. | |
*/ | |
#import "GLView.h" | |
#import <OpenGL/OpenGL.h> | |
#import <OpenGL/gl3.h> | |
@interface GLView() | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGLM_INLINE | |
void | |
glm_aabb_transform(vec3 box[2], mat4 m, vec3 dest[2]) { | |
vec3 v[2], xa, xb, ya, yb, za, zb, tmp; | |
glm_vec_scale(m[0], box[0][0], xa); | |
glm_vec_scale(m[0], box[1][0], xb); | |
glm_vec_scale(m[1], box[0][1], ya); | |
glm_vec_scale(m[1], box[1][1], yb); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source: https://www.opengl.org/discussion_boards/showthread.php/173019-View-Space-Light-Position-Moving | |
vec3 PositionFromDepth_DarkPhoton(in float depth) | |
{ | |
vec2 ndc; // Reconstructed NDC-space position | |
vec3 eye; // Reconstructed EYE-space position | |
eye.z = near * far / ((depth * (far - near)) - far); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void | |
gkPrepareCameraProp(GkCamera * __restrict cam) { | |
mat4 projViewInv; | |
vec4 *vert; | |
vec3 min, max; | |
int32_t i; | |
vert = cam->vertices; | |
glm_mat4_inv(cam->projView, projViewInv); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c), Recep Aslantas. | |
* MIT License (MIT), http://opensource.org/licenses/MIT | |
*/ | |
#version 410 | |
#define AmbientlLight 1u | |
#define DirectionalLight 2u | |
#define PointLight 3u |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c), Recep Aslantas. | |
* MIT License (MIT), http://opensource.org/licenses/MIT | |
*/ | |
#version 410 | |
uniform mat4 MVP; // Projection * View * Model matrix | |
uniform mat4 MV; // View * Model Matrix | |
uniform mat4 NM; // Normal matrix |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ui-app.h> | |
#include <ui-window.h> | |
using namespace ui; | |
int main(int argc, const char *argv[]) { | |
App app; | |
Window mainWindow({{10,0}, {800, 600}}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 410 | |
subroutine | |
vec4 | |
technique(vec4 light, vec3 L); | |
struct ColorOrTex { | |
vec4 color; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 410 | |
uniform mat4 MVP; // Projection * View * Model matrix | |
uniform mat4 MV; // View * Model Matrix | |
uniform mat4 NM; // Normal matrix | |
uniform int NMU; // Use normal matrix | |
layout(location = 0) in vec3 POSITION; | |
layout(location = 1) in vec3 NORMAL; |
NewerOlder