Huge demos update
-moved C stdlib function definitions to ecs_utils.utils -added function to calculate mix(linear interpolation) and rsqrt(fast inverse sqrt) -added some math to vec2 (length, normalize...) -improved renderer with possibility to use multiple materials (one per block, not perfect solution for parallel compute, but works with some requirements) -added blending support for material (opaque, additive, mixed) -added Android support -added gprahical representation for mouse tools (tool_circle.d) -added initial support for editing template components variables -better Component and Templates listing -added possibility to add/removes components using mouse -move CLocation to game_core.basic and reuse in every test -moved tools code from demos to App (now code is fully separated from demos!) -some improvement and fixes in Snake demo, with additional systems to handle adding and removing entities -added new demo: Particles. By now demo has several particles to spawn and support for attractors and vortexes (calculation is made as every attractor with every entity) -fixed bug with window hover and tools -improved tool behaviour -added new material -now window is always opened as maximized windowed mode -some minor fixes and improvements
This commit is contained in:
parent
13e6ed8fd5
commit
e76c5ccdb2
20 changed files with 1804 additions and 288 deletions
52
demos/source/gui/tool_circle.d
Normal file
52
demos/source/gui/tool_circle.d
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
module gui.tool_circle;
|
||||
|
||||
import ecs_utils.gfx.buffer;
|
||||
import ecs_utils.gfx.shader;
|
||||
import ecs_utils.gfx.config;
|
||||
import ecs_utils.gfx.renderer;
|
||||
|
||||
import ecs_utils.math.vector;
|
||||
|
||||
version(WebAssembly)import glad.gl.gles2;
|
||||
else version(Android)import glad.gl.gles2;
|
||||
else import glad.gl.gl;
|
||||
|
||||
struct ToolCircle
|
||||
{
|
||||
//Buffer vbo;
|
||||
//Buffer ibo;
|
||||
|
||||
uint material_id = 1;
|
||||
uint mesh_id = 0;
|
||||
|
||||
/*/void generate()
|
||||
{
|
||||
ushort[]
|
||||
}*/
|
||||
|
||||
void draw(Renderer* renderer, vec2 position, float size, float edge = 1)
|
||||
{
|
||||
position = position * renderer.view_size + renderer.view_pos;
|
||||
vec2 sizes = renderer.view_size * size;
|
||||
vec2 sizes2 = vec2(edge,0);
|
||||
|
||||
import core.stdc.string;
|
||||
ubyte[32] uniform_block;
|
||||
void* ptr = uniform_block.ptr;
|
||||
*cast(float*)(ptr) = sizes.x;
|
||||
*cast(float*)(ptr+4) = 0;
|
||||
*cast(float*)(ptr+8) = 0;
|
||||
*cast(float*)(ptr+12) = sizes.y;
|
||||
memcpy(ptr+16,position.data.ptr,8);
|
||||
memcpy(ptr+24,sizes2.data.ptr,8);
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
GfxConfig.meshes[mesh_id].bind();
|
||||
GfxConfig.materials[material_id].bind();
|
||||
GfxConfig.materials[material_id].pushBindings();
|
||||
GfxConfig.materials[material_id].pushUniforms(uniform_block.ptr);
|
||||
//glDisable(GL_DEPTH_TEST);
|
||||
|
||||
glDrawElements(GL_TRIANGLES,6,GL_UNSIGNED_SHORT,null);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue