#define V_PixelsPerMeter 48.0 #define V_PixelsPerSqMeter (V_PixelsPerMeter * V_PixelsPerMeter) //////////////////////////////////////////////////////////// //~ Constant types G_DeclConstant(G_RWStructuredBufferRef, V_ShaderConst_State, 0); G_DeclConstant(G_StructuredBufferRef, V_ShaderConst_Params, 1); Enum(V_SelectionMode) { V_SelectionMode_None, V_SelectionMode_Tile, }; Struct(V_Xforms) { // World <-> ui Xform world_to_ui; Xform ui_to_world; // Draw <-> ui Xform draw_to_ui; Xform ui_to_draw; // World <-> draw Xform world_to_draw; Xform draw_to_world; // World <-> decal Xform world_to_decal; Xform decal_to_world; }; Struct(V_GpuState) { u32 particle_seq; // Atomic monotonically increasing allocation counter sequence for particle ring buffer }; Struct(V_GpuParams) { f32 dt; Vec2 target_size; G_Texture2DRef target_ro; G_RWTexture2DRef target_rw; V_Xforms xf; u64 seed; G_Texture3DRef noise; V_SelectionMode selection_mode; S_TileKind equipped_tile; b32 has_mouse_focus; b32 has_keyboard_focus; Vec2 ui_cursor; Vec2 draw_cursor; Vec2 world_cursor; Rng2 ui_selection; Rng2 draw_selection; Rng2 world_selection; Vec2 camera_pos; f32 camera_zoom; G_Texture2DRef tiles; G_StructuredBufferRef quads; G_StructuredBufferRef shape_verts; u32 emitters_count; G_StructuredBufferRef emitters; u32 max_particles; G_RWStructuredBufferRef particles; G_RWTexture2DRef decals; }; //////////////////////////////////////////////////////////// //~ Particle types Enum(V_ParticleKind) { V_ParticleKind_None, V_ParticleKind_Test }; Struct(V_Emitter) { V_ParticleKind particle_kind; Vec2 pos; f32 angle; u32 count; f32 speed; u64 seed; f32 angle_spread; f32 speed_spread; }; // TODO: Pack this efficiently Struct(V_Particle) { V_ParticleKind kind; u32 emitter_init_num; // if != 0, then initialize using emitter at index (emitter_init_num - 1) u32 idx_in_emitter; Vec2 pos; Vec2 velocity; }; #if IsLanguageC Struct(V_EmitterNode) { V_EmitterNode *next; V_Emitter emitter; }; #endif //////////////////////////////////////////////////////////// //~ Backdrop shader types #define V_BackdropCSThreadSizeFromTexSize(tex_size) VEC3I32((tex_size.x + 7) / 8, (tex_size.y + 7) / 8, 1) //////////////////////////////////////////////////////////// //~ Quad types Enum(V_DQuadFlag) { V_DQuadFlag_None = 0, V_DQuadFlag_DrawGrid = (1 << 0), }; Struct(V_DQuad) { V_DQuadFlag flags; }; //////////////////////////////////////////////////////////// //~ Vert types Struct(V_DVert) { Vec2 pos; Vec4 color_lin; };