Sat, 19 Apr 2025 12:18:43 +0200
implement view matrix in sprite shader
0 | 1 | # Copyright 2023 Mike Becker. All rights reserved. |
2 | # | |
3 | # Redistribution and use in source and binary forms, with or without | |
4 | # modification, are permitted provided that the following conditions are met: | |
5 | # | |
6 | # 1. Redistributions of source code must retain the above copyright | |
7 | # notice, this list of conditions and the following disclaimer. | |
8 | # | |
9 | # 2. Redistributions in binary form must reproduce the above copyright | |
10 | # notice, this list of conditions and the following disclaimer in the | |
11 | # documentation and/or other materials provided with the distribution. | |
12 | # | |
13 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
14 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
16 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
17 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
18 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
19 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
20 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
21 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
22 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
23 | # POSSIBILITY OF SUCH DAMAGE. | |
24 | # | |
25 | ||
26 | include ../config.mk | |
27 | ||
28 | BUILD_DIR=../build/lib | |
29 | ||
82
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
30 | SRC = context.c glcontext.c error.c window.c shader.c \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
31 | mesh.c primitives.c texture.c \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
32 | sprite.c \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
33 | camera.c scene.c \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
34 | font.c text.c |
0 | 35 | |
36 | OBJ = $(SRC:%.c=$(BUILD_DIR)/%.o) | |
37 | ||
38 | all: $(BUILD_DIR)/libascension.a FORCE | |
6
302971e8599b
move window related stuff to its own unit
Mike Becker <universe@uap-core.de>
parents:
3
diff
changeset
|
39 | @echo "You have successfully ascended." |
0 | 40 | |
41 | $(BUILD_DIR)/libascension.a: $(OBJ) | |
6
302971e8599b
move window related stuff to its own unit
Mike Becker <universe@uap-core.de>
parents:
3
diff
changeset
|
42 | @echo "Creating library..." |
0 | 43 | $(AR) $(ARFLAGS) $@ $^ |
44 | ||
45 | FORCE: | |
46 | ||
37
8a8cc6725b48
add camera and render groups
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
47 | $(BUILD_DIR)/camera.o: camera.c ascension/camera.h ascension/datatypes.h |
8a8cc6725b48
add camera and render groups
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
48 | @echo "Compiling $<" |
8a8cc6725b48
add camera and render groups
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
49 | $(CC) -o $@ $(CFLAGS) -c $< |
8a8cc6725b48
add camera and render groups
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
50 | |
16
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
51 | $(BUILD_DIR)/context.o: context.c ascension/context.h \ |
44
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
52 | ascension/datatypes.h ascension/window.h ascension/glcontext.h \ |
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
53 | ascension/primitives.h ascension/mesh.h ascension/shader.h \ |
82
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
54 | ascension/scene.h ascension/scene_node.h ascension/transform.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
55 | ascension/camera.h ascension/input.h ascension/ui/font.h \ |
77
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
56 | ascension/error.h ascension/utils.h |
6
302971e8599b
move window related stuff to its own unit
Mike Becker <universe@uap-core.de>
parents:
3
diff
changeset
|
57 | @echo "Compiling $<" |
0 | 58 | $(CC) -o $@ $(CFLAGS) -c $< |
59 | ||
16
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
60 | $(BUILD_DIR)/error.o: error.c ascension/context.h ascension/datatypes.h \ |
44
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
61 | ascension/window.h ascension/glcontext.h ascension/primitives.h \ |
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
62 | ascension/mesh.h ascension/shader.h ascension/scene.h \ |
82
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
63 | ascension/scene_node.h ascension/transform.h ascension/camera.h \ |
77
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
64 | ascension/input.h ascension/ui/font.h ascension/error.h \ |
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
65 | ascension/utils.h |
15
362b7659dc76
add shader loading and unloading
Mike Becker <universe@uap-core.de>
parents:
11
diff
changeset
|
66 | @echo "Compiling $<" |
362b7659dc76
add shader loading and unloading
Mike Becker <universe@uap-core.de>
parents:
11
diff
changeset
|
67 | $(CC) -o $@ $(CFLAGS) -c $< |
362b7659dc76
add shader loading and unloading
Mike Becker <universe@uap-core.de>
parents:
11
diff
changeset
|
68 | |
48 | 69 | $(BUILD_DIR)/font.o: font.c ascension/ui/font.h ascension/context.h \ |
44
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
70 | ascension/datatypes.h ascension/window.h ascension/glcontext.h \ |
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
71 | ascension/primitives.h ascension/mesh.h ascension/shader.h \ |
82
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
72 | ascension/scene.h ascension/scene_node.h ascension/transform.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
73 | ascension/camera.h ascension/input.h ascension/ui/font.h \ |
77
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
74 | ascension/error.h |
44
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
75 | @echo "Compiling $<" |
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
76 | $(CC) -o $@ $(CFLAGS) -c $< |
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
77 | |
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
78 | $(BUILD_DIR)/glcontext.o: glcontext.c ascension/glcontext.h \ |
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
79 | ascension/primitives.h ascension/mesh.h ascension/shader.h \ |
78
9bc544f4ce8f
go back to reading shader code from files
Mike Becker <universe@uap-core.de>
parents:
77
diff
changeset
|
80 | ascension/error.h |
16
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
81 | @echo "Compiling $<" |
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
82 | $(CC) -o $@ $(CFLAGS) -c $< |
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
83 | |
81
84a546e282b7
create catch-all util for GL errors + refactors mesh creation
Mike Becker <universe@uap-core.de>
parents:
78
diff
changeset
|
84 | $(BUILD_DIR)/mesh.o: mesh.c ascension/mesh.h ascension/error.h |
84a546e282b7
create catch-all util for GL errors + refactors mesh creation
Mike Becker <universe@uap-core.de>
parents:
78
diff
changeset
|
85 | @echo "Compiling $<" |
84a546e282b7
create catch-all util for GL errors + refactors mesh creation
Mike Becker <universe@uap-core.de>
parents:
78
diff
changeset
|
86 | $(CC) -o $@ $(CFLAGS) -c $< |
84a546e282b7
create catch-all util for GL errors + refactors mesh creation
Mike Becker <universe@uap-core.de>
parents:
78
diff
changeset
|
87 | |
16
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
88 | $(BUILD_DIR)/primitives.o: primitives.c ascension/primitives.h \ |
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
89 | ascension/mesh.h ascension/error.h ascension/context.h \ |
44
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
90 | ascension/datatypes.h ascension/window.h ascension/glcontext.h \ |
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
91 | ascension/primitives.h ascension/shader.h ascension/scene.h \ |
82
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
92 | ascension/scene_node.h ascension/transform.h ascension/camera.h \ |
77
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
93 | ascension/input.h ascension/ui/font.h |
6
302971e8599b
move window related stuff to its own unit
Mike Becker <universe@uap-core.de>
parents:
3
diff
changeset
|
94 | @echo "Compiling $<" |
302971e8599b
move window related stuff to its own unit
Mike Becker <universe@uap-core.de>
parents:
3
diff
changeset
|
95 | $(CC) -o $@ $(CFLAGS) -c $< |
302971e8599b
move window related stuff to its own unit
Mike Becker <universe@uap-core.de>
parents:
3
diff
changeset
|
96 | |
37
8a8cc6725b48
add camera and render groups
Mike Becker <universe@uap-core.de>
parents:
32
diff
changeset
|
97 | $(BUILD_DIR)/scene.o: scene.c ascension/scene.h ascension/datatypes.h \ |
82
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
98 | ascension/scene_node.h ascension/transform.h ascension/camera.h \ |
77
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
99 | ascension/context.h ascension/window.h ascension/glcontext.h \ |
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
100 | ascension/primitives.h ascension/mesh.h ascension/shader.h \ |
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
101 | ascension/scene.h ascension/input.h ascension/ui/font.h \ |
82
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
102 | ascension/utils.h ascension/2d.h ascension/2d/sprite.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
103 | ascension/2d/../scene_node.h ascension/2d/../texture.h |
21
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
16
diff
changeset
|
104 | @echo "Compiling $<" |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
16
diff
changeset
|
105 | $(CC) -o $@ $(CFLAGS) -c $< |
1a47c57666f5
add first draft of a scene graph structure
Mike Becker <universe@uap-core.de>
parents:
16
diff
changeset
|
106 | |
77
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
107 | $(BUILD_DIR)/shader.o: shader.c ascension/shader.h ascension/error.h |
15
362b7659dc76
add shader loading and unloading
Mike Becker <universe@uap-core.de>
parents:
11
diff
changeset
|
108 | @echo "Compiling $<" |
362b7659dc76
add shader loading and unloading
Mike Becker <universe@uap-core.de>
parents:
11
diff
changeset
|
109 | $(CC) -o $@ $(CFLAGS) -c $< |
362b7659dc76
add shader loading and unloading
Mike Becker <universe@uap-core.de>
parents:
11
diff
changeset
|
110 | |
82
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
111 | $(BUILD_DIR)/sprite.o: sprite.c ascension/2d/sprite.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
112 | ascension/2d/../scene_node.h ascension/2d/../datatypes.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
113 | ascension/2d/../transform.h ascension/2d/../texture.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
114 | ascension/context.h ascension/datatypes.h ascension/window.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
115 | ascension/glcontext.h ascension/primitives.h ascension/mesh.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
116 | ascension/shader.h ascension/scene.h ascension/scene_node.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
117 | ascension/camera.h ascension/input.h ascension/ui/font.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
118 | ascension/glcontext.h |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
119 | @echo "Compiling $<" |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
120 | $(CC) -o $@ $(CFLAGS) -c $< |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
121 | |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
122 | $(BUILD_DIR)/text.o: text.c ascension/context.h ascension/datatypes.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
123 | ascension/window.h ascension/glcontext.h ascension/primitives.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
124 | ascension/mesh.h ascension/shader.h ascension/scene.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
125 | ascension/scene_node.h ascension/transform.h ascension/camera.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
126 | ascension/input.h ascension/ui/font.h ascension/error.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
127 | ascension/ui/text.h ascension/ui/font.h ascension/ui/../2d/sprite.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
128 | ascension/ui/../2d/../scene_node.h ascension/ui/../2d/../texture.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
129 | ascension/ui/../utils.h |
50 | 130 | @echo "Compiling $<" |
131 | $(CC) -o $@ $(CFLAGS) -c $< | |
132 | ||
133 | $(BUILD_DIR)/texture.o: texture.c ascension/texture.h ascension/error.h | |
7 | 134 | @echo "Compiling $<" |
135 | $(CC) -o $@ $(CFLAGS) -c $< | |
136 | ||
16
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
137 | $(BUILD_DIR)/window.o: window.c ascension/window.h ascension/datatypes.h \ |
44
b3da4096c607
create own compilation unit for GL context - fixes shader not being created per context
Mike Becker <universe@uap-core.de>
parents:
37
diff
changeset
|
138 | ascension/glcontext.h ascension/primitives.h ascension/mesh.h \ |
82
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
139 | ascension/shader.h ascension/scene.h ascension/scene_node.h \ |
4e1e698f4b0d
add generic mesh draw function and move sprite draw function to separate unit
Mike Becker <universe@uap-core.de>
parents:
81
diff
changeset
|
140 | ascension/transform.h ascension/camera.h ascension/context.h \ |
77
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
141 | ascension/window.h ascension/input.h ascension/ui/font.h \ |
2187a732f4d7
prepare code for embedding shader sources with c23 #embed
Mike Becker <universe@uap-core.de>
parents:
66
diff
changeset
|
142 | ascension/error.h ascension/utils.h |
16
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
143 | @echo "Compiling $<" |
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
144 | $(CC) -o $@ $(CFLAGS) -c $< |
c5dde81b6fb2
add text rendering and demo FPS counter
Mike Becker <universe@uap-core.de>
parents:
15
diff
changeset
|
145 |