Minor Changes

Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
2021-06-09 13:01:35 +02:00
parent 2f2d28dbb1
commit 134081166e
5 changed files with 17 additions and 13 deletions

View File

@@ -9,18 +9,17 @@ this.on_update = function()
local deltaMouseMovement = Input.getDeltaMousePos() local deltaMouseMovement = Input.getDeltaMousePos()
this.angles.y = this.angles.y - deltaMouseMovement.x * this.mouse_sens this.angles.y = this.angles.y - deltaMouseMovement.x * this.mouse_sens
this.eulerAngles = this.angles this.eulerAngles = this.angles
end print('Camera OnUpdate')
this.on_fixedupdate = function()
if Input.getKeyJustPressed(Input.KeyCode.Enter) then if Input.getKeyJustPressed(Input.KeyCode.Enter) then
gotoScene('SideScene') gotoScene('SideScene')
end end
if Input.getKeyDown(Input.KeyCode.Up) then if Input.getKeyDown(Input.KeyCode.Up) then
this.position = this.position + Vec3:new(0, 1, 0) * this.speed this.position = this.position + this:getChild('RotationHelper').forward * this.speed
end end
if Input.getKeyDown(Input.KeyCode.Down) then if Input.getKeyDown(Input.KeyCode.Down) then
this.position = this.position - Vec3:new(0, 1, 0) * this.speed this.position = this.position - this:getChild('RotationHelper').forward * this.speed
end end
if Input.getKeyDown(Input.KeyCode.Right) then if Input.getKeyDown(Input.KeyCode.Right) then
this.position = this.position + Vec3:new(1, 0, 0) * this.speed this.position = this.position + Vec3:new(1, 0, 0) * this.speed

View File

@@ -7,4 +7,5 @@ this.on_update = function()
local deltaMouseMovement = Input.getDeltaMousePos() local deltaMouseMovement = Input.getDeltaMousePos()
this.angles.x = this.angles.x - deltaMouseMovement.y * this.mouse_sens this.angles.x = this.angles.x - deltaMouseMovement.y * this.mouse_sens
this.eulerAngles = this.angles this.eulerAngles = this.angles
print('CameraHelper OnUpdate')
end end

View File

@@ -2,7 +2,7 @@
-- other.position = other.position + Vec3:new(3.2, 0, 0) -- other.position = other.position + Vec3:new(3.2, 0, 0)
-- end -- end
this.on_init = function() this.on_init = function()
print(this:getChild('Child').position:to_string()) -- print(this:getChild('Child').position:to_string())
end end
this.on_update = function () this.on_update = function ()

View File

@@ -35,5 +35,6 @@ void main() {
Vertex vertex = ResourceBuffers[ nonuniformEXT(0) ].resources[PositionBuffers[ nonuniformEXT(0) ].resources[gl_VertexIndex] ]; Vertex vertex = ResourceBuffers[ nonuniformEXT(0) ].resources[PositionBuffers[ nonuniformEXT(0) ].resources[gl_VertexIndex] ];
normal = vertex.normal.xyz; normal = vertex.normal.xyz;
gl_Position = vec4(vertex.position.x, vertex.position.y, vertex.position.z, 1.0); float scale = 0.3;
gl_Position = vec4(vertex.position.x * scale - 0.1, vertex.position.y * scale - 0.7, (vertex.position.z * scale * -1.0 + 0.9), 1.0);
} }

View File

@@ -31,7 +31,7 @@ struct {
evolmodule_t asset_mod; evolmodule_t asset_mod;
evolmodule_t window_mod; evolmodule_t window_mod;
evolmodule_t input_mod; evolmodule_t input_mod;
/* evolmodule_t renderer_mod; */ evolmodule_t renderer_mod;
WindowHandle window; WindowHandle window;
@@ -114,8 +114,11 @@ project_changed_cb()
} }
evstring_free(project_dir); evstring_free(project_dir);
/* Renderer->setWindow((GenericHandle)State.window); */
evol_unloadmodule(State.renderer_mod);
State.renderer_mod = evol_loadmodule("renderer");
Renderer->setWindow((GenericHandle)State.window);
} }
void void
@@ -124,12 +127,12 @@ load_project()
State.game_mod = evol_loadmodule("game"); DEBUG_ASSERT(State.game_mod); State.game_mod = evol_loadmodule("game"); DEBUG_ASSERT(State.game_mod);
State.window_mod = evol_loadmodule("window"); DEBUG_ASSERT(State.window_mod); State.window_mod = evol_loadmodule("window"); DEBUG_ASSERT(State.window_mod);
State.input_mod = evol_loadmodule("input"); DEBUG_ASSERT(State.input_mod); State.input_mod = evol_loadmodule("input"); DEBUG_ASSERT(State.input_mod);
/* State.renderer_mod = evol_loadmodule("renderer"); DEBUG_ASSERT(State.renderer_mod); */ State.renderer_mod = evol_loadmodule("renderer"); DEBUG_ASSERT(State.renderer_mod);
imports(State.game_mod , (Game, Object, Camera, Scene)) imports(State.game_mod , (Game, Object, Camera, Scene))
imports(State.window_mod , (Window)) imports(State.window_mod , (Window))
imports(State.input_mod , (Input)) imports(State.input_mod , (Input))
/* imports(State.renderer_mod, (Renderer)) */ imports(State.renderer_mod, (Renderer))
IMPORT_EVENTS_evmod_glfw(State.window_mod); IMPORT_EVENTS_evmod_glfw(State.window_mod);
U32 width = 800; U32 width = 800;
@@ -211,7 +214,7 @@ load_project()
} }
evstring_free(project_dir); evstring_free(project_dir);
/* Renderer->setWindow((GenericHandle)State.window); */ Renderer->setWindow((GenericHandle)State.window);
} }
@@ -221,7 +224,7 @@ unload_project()
evol_unloadmodule(State.game_mod); evol_unloadmodule(State.game_mod);
evol_unloadmodule(State.input_mod); evol_unloadmodule(State.input_mod);
evol_unloadmodule(State.window_mod); evol_unloadmodule(State.window_mod);
/* evol_unloadmodule(State.renderer_mod); */ evol_unloadmodule(State.renderer_mod);
} }
int main(int argc, char **argv) int main(int argc, char **argv)
@@ -257,7 +260,7 @@ int main(int argc, char **argv)
AssetManager->update(); AssetManager->update();
} }
/* Renderer->run(); */ Renderer->run();
sleep_ms(17); sleep_ms(17);
} }