Compare commits
8 Commits
4f71ecfd6d
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c62ce6bce | |||
| 1e918d5370 | |||
| a2ba43fe79 | |||
| dbca360da2 | |||
| 627380e3e2 | |||
| 12315d2791 | |||
| 7cafe6544b | |||
| 545708571d |
@@ -11,4 +11,6 @@ SET(CMAKE_CXX_FLAGS "-Os -s")
|
|||||||
|
|
||||||
add_executable(one main.cpp)
|
add_executable(one main.cpp)
|
||||||
|
|
||||||
target_link_libraries(one m glfw GLEW GL)
|
find_package(glm REQUIRED)
|
||||||
|
|
||||||
|
target_link_libraries(one m glfw GLEW GL glm::glm)
|
||||||
|
|||||||
14
build.sh
Executable file
14
build.sh
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd build
|
||||||
|
cmake --build .
|
||||||
|
CMD="#!/bin/bash
|
||||||
|
dd bs=1 skip=%s<\$0|unlzma>/tmp/C;chmod +x /tmp/C;trap '' HUP;/tmp/C&"
|
||||||
|
COUNT=$(printf "$CMD" | wc -c)
|
||||||
|
EXTRA=$(printf "$COUNT" | wc -c)
|
||||||
|
COUNT=$((COUNT + EXTRA + 1))
|
||||||
|
echo "$CMD" | sed 's/%s/'"$COUNT"'/' > two
|
||||||
|
chmod +x two
|
||||||
|
sstrip one
|
||||||
|
lzma -9 one
|
||||||
|
cat one.lzma >> two
|
||||||
|
rm one.lzma
|
||||||
2
main.cpp
2
main.cpp
@@ -77,8 +77,6 @@ void framebuffer_size_callback(GLFWwindow *window, int width, int height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
std::cout << "test";
|
|
||||||
std::cout << std::flush;
|
|
||||||
|
|
||||||
GLFWwindow *window;
|
GLFWwindow *window;
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,9 @@
|
|||||||
- [ ] Shader Management
|
- [ ] Shader Management
|
||||||
- [ ] Configure Preprocessor
|
- [ ] Configure Preprocessor
|
||||||
- [ ] Shader Storage
|
- [ ] Shader Storage
|
||||||
|
- [x] Binary compression
|
||||||
|
|
||||||
|
- [x] C++ Math Lib
|
||||||
|
|
||||||
- [ ] SDF
|
- [ ] SDF
|
||||||
- [ ] Basic Shape Rendering
|
- [ ] Basic Shape Rendering
|
||||||
|
|||||||
21
sdf.glsl
21
sdf.glsl
@@ -28,7 +28,7 @@ struct Ray {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Ray createRay(vec3 dir, vec3 pos){
|
Ray createRay(vec3 dir, vec3 pos){
|
||||||
return Ray(dir, pos, .0, .0, SmallHit(80.,0.,false), vec3(.0));
|
return Ray(dir, pos, .0, .0, SmallHit(80.,0.,false), vec3(1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ray applyMin(Ray ray, float min) {
|
Ray applyMin(Ray ray, float min) {
|
||||||
@@ -52,11 +52,11 @@ Ray applyMin(Ray ray, float min) {
|
|||||||
|
|
||||||
|
|
||||||
float planeMin(vec3 pos){
|
float planeMin(vec3 pos){
|
||||||
return pos.y - planeHeight;
|
return pos.y - planeHeight+ 0.2*sin(5*pos.x+t)*sin(5*pos.y+t)*sin(5*pos.z+t);
|
||||||
}
|
}
|
||||||
|
|
||||||
float sphereMin(vec3 pos){
|
float sphereMin(vec3 pos){
|
||||||
return length(pos - center) - radius + 0.2*sin(5*pos.x+t)*sin(5*pos.y+t)*sin(5*pos.z+t);
|
return length(pos - center) - radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ray minFn(Ray ray){
|
Ray minFn(Ray ray){
|
||||||
@@ -88,11 +88,13 @@ Ray march(Ray ray){
|
|||||||
//ray.min = minFn(ray.pos);
|
//ray.min = minFn(ray.pos);
|
||||||
ray = minFn(ray);
|
ray = minFn(ray);
|
||||||
int c = 0;
|
int c = 0;
|
||||||
while(( c < 200) && (ray.min < 100.0f) && (ray.min > 0.01f) ) {
|
while(( c < 1000) && (ray.min < 100.0f) && (ray.min > 0.01f) ) {
|
||||||
ray = minFn(ray);
|
ray = minFn(ray);
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
if(ray.min > 0.01){
|
||||||
|
ray.color = vec3(1.0);
|
||||||
|
}
|
||||||
return ray;
|
return ray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,11 +144,14 @@ void main()
|
|||||||
|
|
||||||
light *= shLeve;
|
light *= shLeve;
|
||||||
|
|
||||||
|
Ray reflectR = createRay(reflect(ray.dir,normal),ray.pos + 0.1* normal);
|
||||||
|
reflectR = march(reflectR);
|
||||||
|
|
||||||
if(ray.min <= 0.2){
|
if(ray.min <= 0.2){
|
||||||
//FragColor = vec4(vec3(shRay.small.min)*0.1,1.0);
|
//FragColor = vec4(0,1,0,1.0);
|
||||||
FragColor = vec4(ray.color * (light+0.3), 1.0);
|
FragColor = vec4(mix(ray.color,reflectR.color,0.3) * (light+0.3), 1.0);
|
||||||
} else {
|
} else {
|
||||||
FragColor = vec4(.0,0.0,0.0,1.0);
|
FragColor = vec4(ray.color,1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user