Funny refactoring (I want to add r1 test)
This commit is contained in:
parent
11bdeb949e
commit
f5fff09144
@ -13,10 +13,10 @@ add_executable(1_test src/l1/tests/t1.c)
|
||||
|
||||
add_executable(codegen_l2 src/l2/codegen.c)
|
||||
|
||||
add_executable(0_render_test src/l2/tests/r0.c)
|
||||
add_executable(0_render_test src/l2/tests/r0/r0.c)
|
||||
target_link_libraries(0_render_test -lvulkan -lX11 -lm)
|
||||
|
||||
add_executable(0_render_test_tex_init_prep src/l2/tests/r0_tex_init_prep.c)
|
||||
add_executable(0_render_test_tex_init_prep src/l2/tests/r0/r0_tex_init_prep.c)
|
||||
target_link_libraries(0_render_test_tex_init_prep -lm)
|
||||
|
||||
add_executable(0_play_test src/l3/tests/p0.c)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "../margaret/margaret.h"
|
||||
#include "../../../gen/geom.h"
|
||||
#include "../../margaret/margaret.h"
|
||||
#include "../../../../gen/geom.h"
|
||||
#include <math.h>
|
||||
#include "../../l1/system/fileio.h"
|
||||
#include "../../../l1/system/fileio.h"
|
||||
#include <time.h>
|
||||
#include "r0_scene.h"
|
||||
#include <sys/wait.h> // Only for linux
|
||||
@ -138,25 +138,25 @@ PipelineHands create_graphics_pipeline_0(
|
||||
.location = 2,
|
||||
.binding = 1,
|
||||
.format = VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
.offset = offsetof(GenericMeshInstance, model_trans) + offsetof(mat4, x)
|
||||
.offset = offsetof(GenericMeshInstance, model_t) + offsetof(mat4, x)
|
||||
},
|
||||
{
|
||||
.location = 3,
|
||||
.binding = 1,
|
||||
.format = VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
.offset = offsetof(GenericMeshInstance, model_trans) + offsetof(mat4, y)
|
||||
.offset = offsetof(GenericMeshInstance, model_t) + offsetof(mat4, y)
|
||||
},
|
||||
{
|
||||
.location = 4,
|
||||
.binding = 1,
|
||||
.format = VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
.offset = offsetof(GenericMeshInstance, model_trans) + offsetof(mat4, z)
|
||||
.offset = offsetof(GenericMeshInstance, model_t) + offsetof(mat4, z)
|
||||
},
|
||||
{
|
||||
.location = 5,
|
||||
.binding = 1,
|
||||
.format = VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
.offset = offsetof(GenericMeshInstance, model_trans) + offsetof(mat4, w)
|
||||
.offset = offsetof(GenericMeshInstance, model_t) + offsetof(mat4, w)
|
||||
},
|
||||
};
|
||||
|
||||
@ -950,11 +950,11 @@ int main() {
|
||||
for (int X = 0; X < 10; X++) {
|
||||
for (int Z = 0; Z < 10; Z++) {
|
||||
VecGenericMeshInstance_append(&VecUsedModelOnScene_at(&scene.models, 0)->instances,
|
||||
(GenericMeshInstance){ .model_trans = marie_translation_mat4((vec3){11.f * (float)X, -6, 4.f * (float)Z}) });
|
||||
(GenericMeshInstance){ .model_t = marie_translation_mat4((vec3){11.f * (float)X, -6, 4.f * (float)Z}) });
|
||||
}
|
||||
}
|
||||
VecGenericMeshInstance_append(&VecUsedModelOnScene_at(&scene.models, 1)->instances, (GenericMeshInstance){
|
||||
.model_trans = mat4_E
|
||||
.model_t = mat4_E
|
||||
});
|
||||
|
||||
void* host_mem_buffer_mem;
|
||||
@ -1145,25 +1145,25 @@ int main() {
|
||||
|
||||
if (pressed_first_0x80[XK_j]) {\
|
||||
Buba_control_info.x -= fl;
|
||||
VecGenericMeshInstance_at(&VecUsedModelOnScene_at(&scene.models, 1)->instances, 0)->model_trans =
|
||||
VecGenericMeshInstance_at(&VecUsedModelOnScene_at(&scene.models, 1)->instances, 0)->model_t =
|
||||
marie_translation_mat4(Buba_control_info);
|
||||
dt_transfer_required = true;
|
||||
}
|
||||
if (pressed_first_0x80[XK_k]) {\
|
||||
Buba_control_info.z -= fl;
|
||||
VecGenericMeshInstance_at(&VecUsedModelOnScene_at(&scene.models, 1)->instances, 0)->model_trans =
|
||||
VecGenericMeshInstance_at(&VecUsedModelOnScene_at(&scene.models, 1)->instances, 0)->model_t =
|
||||
marie_translation_mat4(Buba_control_info);
|
||||
dt_transfer_required = true;
|
||||
}
|
||||
if (pressed_first_0x80[XK_l]) {\
|
||||
Buba_control_info.z += fl;
|
||||
VecGenericMeshInstance_at(&VecUsedModelOnScene_at(&scene.models, 1)->instances, 0)->model_trans =
|
||||
VecGenericMeshInstance_at(&VecUsedModelOnScene_at(&scene.models, 1)->instances, 0)->model_t =
|
||||
marie_translation_mat4(Buba_control_info);
|
||||
dt_transfer_required = true;
|
||||
}
|
||||
if (pressed_first_0x80[XK_semicolon]) {\
|
||||
Buba_control_info.x += fl;
|
||||
VecGenericMeshInstance_at(&VecUsedModelOnScene_at(&scene.models, 1)->instances, 0)->model_trans =
|
||||
VecGenericMeshInstance_at(&VecUsedModelOnScene_at(&scene.models, 1)->instances, 0)->model_t =
|
||||
marie_translation_mat4(Buba_control_info);
|
||||
dt_transfer_required = true;
|
||||
}
|
||||
@ -1,13 +1,13 @@
|
||||
#ifndef SPLITTER_DRAFT_SRC_L2_TESTS_R0_ASSETS_H
|
||||
#define SPLITTER_DRAFT_SRC_L2_TESTS_R0_ASSETS_H
|
||||
|
||||
#include "../marie/graphics_geom.h"
|
||||
#include "../../l1/core/util.h"
|
||||
#include "../../l1/core/VecSpan_int_primitives.h"
|
||||
#include "../../l1/system/fileio.h"
|
||||
#include "../../marie/graphics_geom.h"
|
||||
#include "../../../l1/core/util.h"
|
||||
#include "../../../l1/core/VecSpan_int_primitives.h"
|
||||
#include "../../../l1/system/fileio.h"
|
||||
#include <math.h>
|
||||
#include "../../../gen/pixel_masses.h"
|
||||
#include "../marie/rasterization.h"
|
||||
#include "../../../../gen/pixel_masses.h"
|
||||
#include "../../marie/rasterization.h"
|
||||
|
||||
typedef struct {
|
||||
vec3 pos;
|
||||
@ -20,9 +20,9 @@ typedef struct {
|
||||
VecT_trivmove_struct_Definition(GenericMeshVertex)
|
||||
VecT_trivmove_method_Definition(GenericMeshVertex)
|
||||
VecT_primitive_zeroinit_method_Definition(GenericMeshVertex)
|
||||
SpanT_struct_Definition(GenericMeshVertex)
|
||||
SpanT_method_Definition(GenericMeshVertex)
|
||||
SpanT_VecT_method_Definition(GenericMeshVertex)
|
||||
// SpanT_struct_Definition(GenericMeshVertex)
|
||||
// SpanT_method_Definition(GenericMeshVertex)
|
||||
// SpanT_VecT_method_Definition(GenericMeshVertex)
|
||||
|
||||
typedef struct {
|
||||
VecGenericMeshVertex vertices;
|
||||
@ -55,6 +55,31 @@ VecT_trivmove_struct_Definition(ModelInSceneTemplate)
|
||||
VecT_trivmove_method_Definition(ModelInSceneTemplate)
|
||||
VecT_primitive_zeroinit_method_Definition(ModelInSceneTemplate)
|
||||
|
||||
typedef struct {
|
||||
mat4 model_t;
|
||||
} GenericMeshInstance;
|
||||
|
||||
#define GenericMeshInstance_drop(vp) {}
|
||||
#define GenericMeshInstance_clone(vp) (*(vp))
|
||||
|
||||
VecT_trivmove_struct_Definition(GenericMeshInstance)
|
||||
VecT_trivmove_method_Definition(GenericMeshInstance)
|
||||
VecT_primitive_zeroinit_method_Definition(GenericMeshInstance)
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
vec3 pos;
|
||||
vec3 normal;
|
||||
} ShinyMeshVertex;
|
||||
|
||||
typedef struct {
|
||||
mat4 model_t;
|
||||
vec3 color_off;
|
||||
vec3 color_on;
|
||||
} ShinyMeshInstance;
|
||||
|
||||
|
||||
typedef struct {
|
||||
vec2 win_scale;
|
||||
} Pipeline1PushRangeVertex;
|
||||
@ -98,16 +123,6 @@ VecT_trivmove_struct_Definition(Pipeline0PointLight)
|
||||
VecT_trivmove_method_Definition(Pipeline0PointLight)
|
||||
VecT_primitive_zeroinit_method_Definition(Pipeline0PointLight)
|
||||
|
||||
typedef struct {
|
||||
mat4 model_trans;
|
||||
} GenericMeshInstance;
|
||||
|
||||
#define GenericMeshInstance_drop(vp) {}
|
||||
#define GenericMeshInstance_clone(vp) (*(vp))
|
||||
|
||||
VecT_trivmove_struct_Definition(GenericMeshInstance)
|
||||
VecT_trivmove_method_Definition(GenericMeshInstance)
|
||||
VecT_primitive_zeroinit_method_Definition(GenericMeshInstance)
|
||||
|
||||
|
||||
typedef struct {
|
||||
@ -170,6 +185,7 @@ U8 a_small_cute_gradient(float r_cut, float r_decay, float dist) {
|
||||
return dist > r_cut ? 0 : (dist < r_decay) ? 255 : (U8)roundf( 255.f * (r_cut - dist) / (r_cut - r_decay) );
|
||||
}
|
||||
|
||||
// todo: delete this crap
|
||||
void TextureDataR8_seg_vertical_strip_maxing(TextureDataR8* self, S32 x, float y_real, float vert_r_cut, float vert_r_decay) {
|
||||
S32 y = (S32)roundf(y_real - 0.5f);
|
||||
S32 k = (S32)ceilf(vert_r_cut);
|
||||
@ -179,6 +195,7 @@ void TextureDataR8_seg_vertical_strip_maxing(TextureDataR8* self, S32 x, float y
|
||||
}
|
||||
}
|
||||
|
||||
// todo: delete this crap
|
||||
void TextureDataR8_seg_horizontal_strip_maxing(TextureDataR8* self, float x_real, S32 y, float hor_r_cut, float hor_r_decay) {
|
||||
S32 x = (S32)roundf(x_real - 0.5f);
|
||||
S32 k = (S32)ceilf(hor_r_cut);
|
||||
@ -209,6 +226,7 @@ void TextureDataR8_draw_horizontal_inner_line_maxing(TextureDataR8* self,
|
||||
}
|
||||
}
|
||||
|
||||
// todo: delete this crap
|
||||
/* abs(x2 - x1) < abs(y2 - y1) y1 <= y2 */
|
||||
void TextureDataR8_draw_vertical_inner_line_maxing(TextureDataR8* self,
|
||||
float x1, float y1, float x2, float y2, float r_cut, float r_decay) {
|
||||
@ -228,6 +246,7 @@ void TextureDataR8_draw_vertical_inner_line_maxing(TextureDataR8* self,
|
||||
TextureDataR8_seg_horizontal_strip_maxing(self, real_x, y, hor_r_cut, hor_r_decay);
|
||||
}
|
||||
}
|
||||
// todo: delete this crap
|
||||
|
||||
void TextureDataR8_draw_inner_line_maxing(TextureDataR8* self,
|
||||
vec2 v1, vec2 v2, float r_cut, float r_decay) {
|
||||
@ -247,6 +266,7 @@ void TextureDataR8_draw_inner_line_maxing(TextureDataR8* self,
|
||||
}
|
||||
}
|
||||
}
|
||||
// todo: delete this crap
|
||||
|
||||
void TextureDataR8_draw_spot_maxing(TextureDataR8* self, vec2 v, float r_cut, float r_decay) {
|
||||
S32 sx = (S32)roundf(v.x - .5f);
|
||||
@ -261,6 +281,7 @@ void TextureDataR8_draw_spot_maxing(TextureDataR8* self, vec2 v, float r_cut, fl
|
||||
}
|
||||
}
|
||||
}
|
||||
// todo: delete this crap
|
||||
|
||||
void TextureDataR8_draw_one_segment_maxing(TextureDataR8* self,
|
||||
vec2 v1, vec2 v2, float r_cut, float r_decay) {
|
||||
@ -1,5 +1,5 @@
|
||||
#include "r0_assets.h"
|
||||
#include "../marie/rasterization.h"
|
||||
#include "../../marie/rasterization.h"
|
||||
|
||||
void draw_cool_triangle_h_frag(void* ug, S32 x, S32 y, MarieVertAttr attr_col) {
|
||||
TextureDataR8G8B8* tex = (TextureDataR8G8B8*)ug;
|
||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user