Updated test scene and testing shader compilation
Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
@@ -25,5 +25,5 @@
|
|||||||
"path": "scenes://SideScene.evsc"
|
"path": "scenes://SideScene.evsc"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"activeScene": "SideScene"
|
"activeScene": "MainScene"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
{
|
{
|
||||||
"type": "CameraComponent",
|
"type": "CameraComponent",
|
||||||
"view": "Perspective",
|
"view": "Perspective",
|
||||||
"fov": 120,
|
"fov": 60,
|
||||||
"near": 0.001,
|
"near": 0.001,
|
||||||
"far": 1000,
|
"far": 1000,
|
||||||
"aspectRatio": 1.3333
|
"aspectRatio": 1.3333
|
||||||
|
|||||||
@@ -40,8 +40,9 @@
|
|||||||
"mass": 1.0,
|
"mass": 1.0,
|
||||||
"restitution": 1.0,
|
"restitution": 1.0,
|
||||||
"collisionShape": {
|
"collisionShape": {
|
||||||
"type": "Sphere",
|
"type": "Capsule",
|
||||||
"radius": 1.0
|
"radius": 1.0,
|
||||||
|
"height": 2.0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -79,6 +80,32 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "Ceiling",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "TransformComponent",
|
||||||
|
"position": [0.0, 15.0, -15.0],
|
||||||
|
"rotation": [0.0, 0.0, 0.0],
|
||||||
|
"scale": [1.0, 1.0, 1.0]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "RigidbodyComponent",
|
||||||
|
"rigidbodyType": "Ghost",
|
||||||
|
"mass": 0.0,
|
||||||
|
"restitution": 0.0,
|
||||||
|
"collisionShape": {
|
||||||
|
"type": "Box",
|
||||||
|
"halfExtents": [10.0, 10.0, 10.0]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ScriptComponent",
|
||||||
|
"script_name": "SideGhostController",
|
||||||
|
"script_path": "scripts://SideScene/ghost.lua"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "Ground",
|
"id": "Ground",
|
||||||
"components": [
|
"components": [
|
||||||
|
|||||||
@@ -1,10 +1,20 @@
|
|||||||
this.on_init = function()
|
this.on_init = function()
|
||||||
this.speed = 0.1
|
this.speed = 0.1
|
||||||
this.original_position = this.position
|
this.original_position = this.position
|
||||||
|
this.angles = Vec3:new()
|
||||||
|
this.mouse_sens = 0.01
|
||||||
|
Input.lockCursor()
|
||||||
|
end
|
||||||
|
|
||||||
|
this.on_update = function()
|
||||||
|
local deltaMouseMovement = Input.getDeltaMousePos()
|
||||||
|
this.angles.x = this.angles.x - deltaMouseMovement.y * this.mouse_sens
|
||||||
|
this.angles.y = this.angles.y - deltaMouseMovement.x * this.mouse_sens
|
||||||
|
this.eulerAngles = this.angles
|
||||||
end
|
end
|
||||||
|
|
||||||
this.on_fixedupdate = function()
|
this.on_fixedupdate = function()
|
||||||
if Input.getKeyDown(Input.KeyCode.Enter) then
|
if Input.getKeyJustPressed(Input.KeyCode.Enter) then
|
||||||
gotoScene('SideScene')
|
gotoScene('SideScene')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,28 @@
|
|||||||
this.on_init = function()
|
this.on_init = function()
|
||||||
this.speed = 0.1
|
this.speed = 0.1
|
||||||
this.original_position = this.position
|
this.original_position = this.position
|
||||||
|
this.cursor_locked = false
|
||||||
end
|
end
|
||||||
|
|
||||||
this.on_fixedupdate = function()
|
this.on_fixedupdate = function()
|
||||||
if Input.getKeyDown(Input.KeyCode.Enter) then
|
if Input.getKeyJustPressed(Input.KeyCode.Enter) then
|
||||||
gotoScene('MainScene')
|
gotoScene('MainScene')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Input.getKeyDown(Input.KeyCode.L) then
|
||||||
|
if this.cursor_locked then
|
||||||
|
Input.unlockCursor()
|
||||||
|
else
|
||||||
|
Input.lockCursor()
|
||||||
|
end
|
||||||
|
this.cursor_locked = not this.cursor_locked
|
||||||
|
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 - Vec3:new(0, 0, 1) * 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 + Vec3:new(0, 0, 1) * 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
|
||||||
|
|||||||
8
res/project/res/scripts/SideScene/ghost.lua
Normal file
8
res/project/res/scripts/SideScene/ghost.lua
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
this.on_collisionenter = function(other)
|
||||||
|
print(other.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
this.on_update = function ()
|
||||||
|
local player = getObject('Player.Child')
|
||||||
|
this.position = player.position + Vec3:new(0, 10, 0)
|
||||||
|
end
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
-- this.on_collisionenter = function(other)
|
-- this.on_collisionenter = function(other)
|
||||||
-- 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()
|
||||||
|
print(this:getChild('Child').position:to_string())
|
||||||
|
end
|
||||||
|
|
||||||
this.on_update = function ()
|
this.on_update = function ()
|
||||||
rb = this:getComponent(Rigidbody)
|
rb = this:getComponent(Rigidbody)
|
||||||
|
|||||||
5
res/project/triangle.vert
Normal file
5
res/project/triangle.vert
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#version 450
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
gl_Position = vec4(0);
|
||||||
|
}
|
||||||
24
src/main.c
24
src/main.c
@@ -18,10 +18,8 @@ DECLARE_EVENT_LISTENER(keyPressedListener, (KeyPressedEvent *event) {
|
|||||||
if(event->keyCode == 81) // tests if Q was pressed
|
if(event->keyCode == 81) // tests if Q was pressed
|
||||||
Window->setShouldClose(event->handle, true);
|
Window->setShouldClose(event->handle, true);
|
||||||
|
|
||||||
else if(event->keyCode == 49) // Numrow 1
|
/* else if(event->keyCode == 49) // Numrow 1 */
|
||||||
Game->setActiveScene(Scene->getFromName("MainScene"));
|
/* else if(event->keyCode == 50) // Numrow 2 */
|
||||||
else if(event->keyCode == 50) // Numrow 2
|
|
||||||
Game->setActiveScene(Scene->getFromName("SisyphusoScene"));
|
|
||||||
/* else if(event->keyCode == 45) // Numrow - */
|
/* else if(event->keyCode == 45) // Numrow - */
|
||||||
/* else if(event->keyCode == 61) // Numrow = */
|
/* else if(event->keyCode == 61) // Numrow = */
|
||||||
})
|
})
|
||||||
@@ -37,7 +35,7 @@ int main(int argc, char **argv)
|
|||||||
evolmodule_t window_mod = evol_loadmodule("window"); DEBUG_ASSERT(window_mod);
|
evolmodule_t window_mod = evol_loadmodule("window"); DEBUG_ASSERT(window_mod);
|
||||||
evolmodule_t input_mod = evol_loadmodule("input"); DEBUG_ASSERT(input_mod);
|
evolmodule_t input_mod = evol_loadmodule("input"); DEBUG_ASSERT(input_mod);
|
||||||
|
|
||||||
imports(asset_mod , (AssetManager, Asset, TextLoader, JSONLoader))
|
imports(asset_mod , (AssetManager, Asset, TextLoader, JSONLoader, ShaderLoader))
|
||||||
imports(game_mod , (Game, Object, Camera, Scene))
|
imports(game_mod , (Game, Object, Camera, Scene))
|
||||||
imports(window_mod , (Window))
|
imports(window_mod , (Window))
|
||||||
imports(input_mod , (Input))
|
imports(input_mod , (Input))
|
||||||
@@ -63,6 +61,14 @@ int main(int argc, char **argv)
|
|||||||
AssetManager->mount(&project_dir, &project_mountpoint);
|
AssetManager->mount(&project_dir, &project_mountpoint);
|
||||||
evstring_free(project_mountpoint);
|
evstring_free(project_mountpoint);
|
||||||
|
|
||||||
|
AssetHandle shader_asset = Asset->load("project://triangle.vert");
|
||||||
|
ShaderAsset shader_bin = ShaderLoader->loadAsset(shader_asset, EV_SHADERASSETSTAGE_VERTEX, "TriangleVertex", "main", EV_SHADER_BIN);
|
||||||
|
ShaderAsset shader_asm = ShaderLoader->loadAsset(shader_asset, EV_SHADERASSETSTAGE_VERTEX, "TriangleVertex", "main", EV_SHADER_ASM);
|
||||||
|
|
||||||
|
ev_log_debug("Shader Binary: %.*s", shader_bin.len, shader_bin.binary);
|
||||||
|
ev_log_debug("Shader Assembly: %.*s", shader_asm.len, shader_asm.binary);
|
||||||
|
|
||||||
|
Asset->free(shader_asset);
|
||||||
|
|
||||||
EV_DEFER(
|
EV_DEFER(
|
||||||
AssetHandle project_config = Asset->load("project://game.proj"),
|
AssetHandle project_config = Asset->load("project://game.proj"),
|
||||||
@@ -119,14 +125,14 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
U32 result = 0;
|
U32 result = 0;
|
||||||
while(result == 0) {
|
while(result == 0) {
|
||||||
ev_ProfileCPU(EventSystemProgress, 0) {
|
|
||||||
result |= EventSystem.progress();
|
|
||||||
}
|
|
||||||
|
|
||||||
ev_ProfileCPU(WindowUpdate, 0) {
|
ev_ProfileCPU(WindowUpdate, 0) {
|
||||||
result |= Window->update(windowHandle);
|
result |= Window->update(windowHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ev_ProfileCPU(EventSystemProgress, 0) {
|
||||||
|
result |= EventSystem.progress();
|
||||||
|
}
|
||||||
|
|
||||||
ev_ProfileCPU(GameProgress, 0) {
|
ev_ProfileCPU(GameProgress, 0) {
|
||||||
result |= Game->progress(0.01666667f);
|
result |= Game->progress(0.01666667f);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user