Skip to content

Commit 2970085

Browse files
committed
Adds initial project files.
0 parents  commit 2970085

File tree

166 files changed

+19871
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+19871
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
images/**
2+
blends/**
3+
*.kra~
4+
*.png~
5+
*main.o*
6+
*3d-game-shaders-for-beginners.o*
7+
*3d-game-shaders-for-beginners*
8+
!blends/*
9+
!blends/mill-scene/mill-scene-low-poly-backup.blend

README.md

Lines changed: 76 additions & 0 deletions

demonstration/build-for-linux.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
SCRIPT_PATH="$(cd "$(dirname "$0")"; pwd -P)"
4+
5+
g++ \
6+
-Wfatal-errors \
7+
-c $SCRIPT_PATH/src/main.cxx \
8+
-o $SCRIPT_PATH/3d-game-shaders-for-beginners.o \
9+
-std=gnu++11 \
10+
-O3 \
11+
-I/usr/include/python3.9/ \
12+
-I$P3D_INCLUDE_PATH
13+
14+
g++ \
15+
$SCRIPT_PATH/3d-game-shaders-for-beginners.o \
16+
-o $SCRIPT_PATH/3d-game-shaders-for-beginners \
17+
-L$P3D_LIB_PATH \
18+
-lp3framework \
19+
-lpanda \
20+
-lpandafx \
21+
-lpandaexpress \
22+
-lpandaphysics \
23+
-lp3dtoolconfig \
24+
-lp3dtool \
25+
-lpthread
36.6 KB
Binary file not shown.
8.63 MB
Binary file not shown.
68.4 KB
Binary file not shown.
842 Bytes
254 Bytes
253 Bytes
564 Bytes
100 Bytes
133 KB
Binary file not shown.

demonstration/fonts/font.ttf

71.8 KB
Binary file not shown.

demonstration/images/blank.png

842 Bytes

demonstration/images/color-noise.png

60.4 KB

demonstration/images/foam-pattern.png

3.72 MB
5.06 KB
7.31 KB
148 Bytes

demonstration/images/smoke.png

20.8 KB

demonstration/images/still-flow.png

564 Bytes

demonstration/images/up-flow.png

565 Bytes

demonstration/panda3d-prc-file.prc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
load-display pandagl
2+
3+
audio-library-name p3openal_audio
4+
5+
win-origin -2 -2
6+
win-size 1200 900
7+
8+
fullscreen #f
9+
10+
framebuffer-hardware #t
11+
framebuffer-software #f
12+
13+
framebuffer-srgb #f
14+
15+
depth-bits 1
16+
color-bits 1 1 1
17+
alpha-bits 0
18+
stencil-bits 0
19+
multisamples 0
20+
21+
notify-level warning
22+
default-directnotify-level warning
23+
24+
model-path $MAIN_DIR
25+
26+
want-directtools #f
27+
want-tk #f
28+
29+
want-pstats #f
30+
show-frame-rate-meter #f
31+
32+
use-movietexture #t
33+
34+
hardware-animated-vertices #f
35+
36+
model-cache-dir $XDG_CACHE_HOME/panda3d
37+
model-cache-textures #f
38+
39+
basic-shaders-only #f
40+
41+
gl-coordinate-system default
42+
gl-version 3 2
43+
44+
textures-auto-power-2 1
45+
textures-power-2 down
46+
47+
sync-flip #f
48+
sync-video #f

demonstration/shaders/LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2019, David Lettier
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
(C) 2019 David Lettier
3+
lettier.com
4+
*/
5+
6+
#version 150
7+
8+
uniform sampler2D baseTexture;
9+
uniform sampler2D refractionTexture;
10+
uniform sampler2D foamTexture;
11+
uniform sampler2D reflectionTexture;
12+
uniform sampler2D specularTexture;
13+
14+
out vec4 fragColor;
15+
16+
void main() {
17+
vec2 texSize = textureSize(baseTexture, 0).xy;
18+
vec2 texCoord = gl_FragCoord.xy / texSize;
19+
20+
vec4 base = texture(baseTexture, texCoord);
21+
vec4 refraction = texture(refractionTexture, texCoord);
22+
vec4 foam = texture(foamTexture, texCoord);
23+
vec4 reflection = texture(reflectionTexture, texCoord);
24+
vec4 specular = texture(specularTexture, texCoord);
25+
26+
fragColor = base;
27+
fragColor.rgb = mix(fragColor.rgb, refraction.rgb, clamp(refraction.a, 0.0, 1.0));
28+
fragColor.rgb = mix(fragColor.rgb, reflection.rgb, clamp(reflection.a, 0.0, 1.0));
29+
fragColor.rgb = mix(fragColor.rgb, foam.rgb, clamp(foam.a, 0.0, 1.0));
30+
fragColor.rgb += (specular.rgb * clamp(specular.a, 0.0, 1.0));
31+
}

0 commit comments

Comments
 (0)