@@ -13,42 +13,6 @@ namespace spec = render::attrib_layout::spec;
1313using render::VertexArray;
1414using AttribIndexBuilder = decltype (Renderer::chunk_vertex_builder());
1515
16- constexpr auto coords = std::array<std::array<Vec3f, 4 >, 6 >({
17- {{{1 .0f , 0 .0f , 1 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {1 .0f , 1 .0f , 1 .0f }}}, // Right
18- {{{0 .0f , 0 .0f , 0 .0f }, {0 .0f , 0 .0f , 1 .0f }, {0 .0f , 1 .0f , 1 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Left
19- {{{0 .0f , 1 .0f , 1 .0f }, {1 .0f , 1 .0f , 1 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Top
20- {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 1 .0f }, {0 .0f , 0 .0f , 1 .0f }}}, // Bottom
21- {{{0 .0f , 0 .0f , 1 .0f }, {1 .0f , 0 .0f , 1 .0f }, {1 .0f , 1 .0f , 1 .0f }, {0 .0f , 1 .0f , 1 .0f }}}, // Front
22- {{{1 .0f , 0 .0f , 0 .0f }, {0 .0f , 0 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }}}, // Back
23- });
24-
25- constexpr auto tex_coords = std::array<std::array<Vec3f, 4 >, 6 >({
26- {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Right
27- {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Left
28- {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Top
29- {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Bottom
30- {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Front
31- {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Back
32- });
33-
34- constexpr auto tangents = std::array<Vec3i8, 6 >({
35- { 0 , 0 , -1 }, // Right
36- { 0 , 0 , +1 }, // Left
37- {+1 , 0 , 0 }, // Top
38- {+1 , 0 , 0 }, // Bottom
39- {+1 , 0 , 0 }, // Front
40- {-1 , 0 , 0 }, // Back
41- });
42-
43- constexpr auto bitangents = std::array<Vec3i8, 6 >({
44- {0 , +1 , 0 }, // Right
45- {0 , +1 , 0 }, // Left
46- {0 , 0 , -1 }, // Top
47- {0 , 0 , +1 }, // Bottom
48- {0 , +1 , 0 }, // Front
49- {0 , +1 , 0 }, // Back
50- });
51-
5216export namespace particles {
5317
5418struct Particle {
@@ -73,7 +37,7 @@ void update(worlds::World& world, Particle& ptc) {
7337 velocity.y () -= 0.03 ;
7438 auto velocity_original = velocity;
7539
76- auto particle_box = AABB3d (position - ptc. psize , position + ptc.psize );
40+ auto particle_box = AABB3d (position, position + ptc.psize );
7741 velocity = particle_box.clip_displacement (world.hitboxes (particle_box.extend (velocity)), velocity);
7842 position += velocity;
7943
@@ -97,6 +61,42 @@ void update_all(worlds::World& world) {
9761}
9862
9963void mesh (worlds::World& world, Particle const & ptc, double interp, AttribIndexBuilder& v) {
64+ constexpr auto coords = std::array<std::array<Vec3f, 4 >, 6 >({
65+ {{{1 .0f , 0 .0f , 1 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {1 .0f , 1 .0f , 1 .0f }}}, // Right
66+ {{{0 .0f , 0 .0f , 0 .0f }, {0 .0f , 0 .0f , 1 .0f }, {0 .0f , 1 .0f , 1 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Left
67+ {{{0 .0f , 1 .0f , 1 .0f }, {1 .0f , 1 .0f , 1 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Top
68+ {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 1 .0f }, {0 .0f , 0 .0f , 1 .0f }}}, // Bottom
69+ {{{0 .0f , 0 .0f , 1 .0f }, {1 .0f , 0 .0f , 1 .0f }, {1 .0f , 1 .0f , 1 .0f }, {0 .0f , 1 .0f , 1 .0f }}}, // Front
70+ {{{1 .0f , 0 .0f , 0 .0f }, {0 .0f , 0 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }}}, // Back
71+ });
72+
73+ constexpr auto tex_coords = std::array<std::array<Vec3f, 4 >, 6 >({
74+ {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Right
75+ {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Left
76+ {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Top
77+ {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Bottom
78+ {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Front
79+ {{{0 .0f , 0 .0f , 0 .0f }, {1 .0f , 0 .0f , 0 .0f }, {1 .0f , 1 .0f , 0 .0f }, {0 .0f , 1 .0f , 0 .0f }}}, // Back
80+ });
81+
82+ constexpr auto tangents = std::array<Vec3i8, 6 >({
83+ { 0 , 0 , -1 }, // Right
84+ { 0 , 0 , +1 }, // Left
85+ {+1 , 0 , 0 }, // Top
86+ {+1 , 0 , 0 }, // Bottom
87+ {+1 , 0 , 0 }, // Front
88+ {-1 , 0 , 0 }, // Back
89+ });
90+
91+ constexpr auto bitangents = std::array<Vec3i8, 6 >({
92+ {0 , +1 , 0 }, // Right
93+ {0 , +1 , 0 }, // Left
94+ {0 , 0 , -1 }, // Top
95+ {0 , 0 , +1 }, // Bottom
96+ {0 , +1 , 0 }, // Front
97+ {0 , +1 , 0 }, // Back
98+ });
99+
100100 auto psize = static_cast <float >(ptc.psize );
101101 auto bl = ptc.bl .get ();
102102 auto tex = static_cast <float >(ptc.tex );
0 commit comments