Began Newton Dynamics Physics integration and modified build script

dev
Shariq Shah 8 years ago
parent 5ecb721dac
commit ac12a48b8a
  1. 1
      README.md
  2. 216
      build/genie.lua
  3. 1316
      include/common/newton/Newton.h
  4. BIN
      lib/windows/newton/newton.dll
  5. BIN
      lib/windows/newton/newton.exp
  6. BIN
      lib/windows/newton/newton.lib
  7. BIN
      lib/windows/newton/newton_d.dll
  8. BIN
      lib/windows/newton/newton_d.exp
  9. BIN
      lib/windows/newton/newton_d.lib
  10. BIN
      lib/windows/newton/newton_d.pdb
  11. 4
      src/common/array_str.h
  12. 17
      src/common/common.h
  13. 11
      src/game/main.c
  14. 27
      src/game/physics.c
  15. 7
      src/game/physics.h
  16. 256
      src/libsymmetry/game.c
  17. 4
      src/libsymmetry/scene.c

@ -155,6 +155,7 @@
- ## TODO
- Complete Newton integration
- Add fallback shader
- Implement Game States
- Store Materials in new format supported by parser

@ -8,9 +8,15 @@ solution "Symmetry"
postbuildcommands {"ln -fs " .. os.getcwd() .. "/../assets release/assets"}
buildoptions {"-Wall", "-std=c99", "`pkg-config --cflags-only-I sdl2`"}
configuration {"windows", "vs2017"}
defines {"_CRT_SECURE_NO_WARNINGS"}
flags {"NoIncrementalLink", "NoEditAndContinue"}
configuration {"windows", "vs2017"}
defines {"_CRT_SECURE_NO_WARNINGS"}
flags {"NoIncrementalLink", "NoEditAndContinue"}
local windowsPlatform = string.gsub(os.getenv("WindowsSDKVersion") or "10.0.16299.0", "\\", "")
local action = premake.action.current()
if(action ~= nil) then
action.vstudio.windowsTargetPlatformVersion = windowsPlatform
action.vstudio.windowsTargetPlatformMinVersion = windowsPlatform
end
configuration "Debug"
if (_ACTION ~= nil and _ACTION ~= "postbuild_copy") then
@ -28,111 +34,99 @@ solution "Symmetry"
defines { "NDEBUG", "ExtraWarnings" }
flags { "OptimizeSpeed"}
-------------------------
-- Game
-------------------------
project "Game"
kind "ConsoleApp"
targetname "Symmetry"
language "C"
files { "../src/common/**.c", "../src/common/**.h", "../src/game/**.c", "../src/game/**.h"}
defines {"GAME"}
configuration "linux"
includedirs {"../include/linux/sdl2/", "../include/common/soloud/"}
libdirs {"../lib/linux/sdl2/", "../lib/linux/soloud/"}
links {"SDL2", "m"}
configuration {"windows", "vs2017"}
includedirs {"../include/windows/sdl2/", "../include/common/soloud/"}
libdirs {"../lib/windows/sdl2/", "../lib/windows/soloud/"}
links {"SDL2"}
configuration "Debug"
links {"soloud_x64_d"}
configuration "Release"
links {"soloud_x64"}
configuration {"windows", "Release", "vs2017"}
postbuildcommands {
"xcopy ..\\..\\assets ..\\..\\bin\\assets /s /e /h /i /y /d",
"copy release\\Symmetry.exe ..\\..\\bin\\ /Y",
"copy release\\libSymmetry.dll ..\\..\\bin\\ /Y",
"copy release\\SDL2.dll ..\\..\\bin\\ /Y",
"copy release\\soloud_x64.dll ..\\..\\bin\\ /Y",
}
newaction {
trigger = "postbuild_copy",
description = "Action to copy relevant dlls to executable directory after build",
execute = function ()
local copy_dest_dir = ""
local symlink_dest_dir = ""
if(_ARGS[1] == "vs2017") then
copy_dest_dir = "vs2017"
symlink_dest_dir = "..\\..\\..\\assets"
printf("Copying DLLs to visual studio build directory...\n")
else
copy_dest_dir = "projects/qbs"
symlink_dest_dir = "..\\..\\..\\..\\assets"
printf("Copying DLLs to qbs build directory...\n")
end
local success = false
success = os.copyfile("../libs/windows/sdl2/SDL2.dll", copy_dest_dir .. "/debug/SDL2.dll")
success = os.copyfile("../libs/windows/sdl2/SDL2.dll", copy_dest_dir .. "/release/SDL2.dll")
success = os.copyfile("../libs/windows/soloud_x64_d.dll", copy_dest_dir .. "/debug/soloud_x64_d.dll")
success = os.copyfile("../libs/windows/soloud_x64.dll", copy_dest_dir .. "/release/soloud_x64.dll")
if success ~= true then
printf("Copying one or more dlls failed.")
else
printf("Copying dlls successful.")
end
-- Create sym links
local output = os.outputof("mklink /D " .. path.translate(copy_dest_dir, "\\") .. "\\debug\\assets " .. symlink_dest_dir)
printf("MKlink debug output : %s", output)
output = os.outputof("mklink /D " .. path.translate(copy_dest_dir, "\\") .. "\\release\\assets " ..symlink_dest_dir)
printf("MKlink release output : %s", output)
end
}
if(_ACTION == "vs2017") then
postbuildcommands
{
_PREMAKE_COMMAND .. " postbuild_copy vs2017"
}
else
postbuildcommands
{
_PREMAKE_COMMAND .. " postbuild_copy qbs"
}
end
-------------------------
-- libSymmetry
-------------------------
project "Library"
kind "SharedLib"
language "C"
targetname "Symmetry"
defines {"GAME_LIB", "USE_GLAD"}
includedirs {"../include/common"}
files { "../src/common/**.c", "../src/common/**.h", "../src/libsymmetry/**.h", "../src/libsymmetry/**.c" }
configuration "windows"
targetname "libSymmetry"
configuration {"windows", "vs2017"}
includedirs {"../include/windows/sdl2/"}
flags "NoImportLib"
configuration {"linux"}
includedirs {"../include/linux/sdl2/"}
configuration "Debug"
defines {"GL_DEBUG_CONTEXT"}
newaction {
trigger = "postbuild_copy",
description = "Action to copy relevant dlls to executable directory after build",
execute = function ()
-- local copy_dest_dir = ""
-- local symlink_dest_dir = ""
-- if(_ARGS[1] == "vs2017") then
-- copy_dest_dir = "vs2017"
-- symlink_dest_dir = "..\\..\\..\\assets"
-- printf("Copying DLLs to visual studio build directory...\n")
-- end
-- -- Create sym links
-- local output = os.outputof("mklink /D vs2017\\debug\\assets ..\\..\\..\\assets" .. path.translate(copy_dest_dir, "\\") .. "\\debug\\assets " .. symlink_dest_dir)
-- printf("MKlink debug output : %s", output)
-- output = os.outputof("mklink /D " .. path.translate(copy_dest_dir, "\\") .. "\\release\\assets " ..symlink_dest_dir)
-- printf("MKlink release output : %s", output)
end
}
-------------------------
-- Game
-------------------------
project "Game"
kind "ConsoleApp"
targetname "Symmetry"
language "C"
files { "../src/common/**.c", "../src/common/**.h", "../src/game/**.c", "../src/game/**.h"}
defines {"GAME"}
configuration "linux"
includedirs {"../include/linux/sdl2/", "../include/common/soloud/"}
libdirs {"../lib/linux/sdl2/", "../lib/linux/soloud/"}
links {"SDL2", "m"}
configuration {"windows", "vs2017"}
includedirs {"../include/windows/sdl2/", "../include/common/soloud/", "../include/common/newton/"}
libdirs {"../lib/windows/sdl2/", "../lib/windows/soloud/", "../lib/windows/newton/"}
links {"SDL2"}
configuration "Debug"
links {"soloud_x64_d", "newton_d"}
configuration "Release"
links {"soloud_x64", "newton"}
configuration {"windows", "Release", "vs2017"}
postbuildcommands
{
"copy ..\\..\\lib\\windows\\sdl2\\SDL2.dll release\\ /Y",
"copy ..\\..\\lib\\windows\\soloud\\soloud_x64.dll release\\ /Y",
"copy ..\\..\\lib\\windows\\newton\\newton.dll release\\ /Y",
"xcopy ..\\..\\assets ..\\..\\bin\\assets /s /e /h /i /y /d",
"copy release\\Symmetry.exe ..\\..\\bin\\ /Y",
"copy release\\libSymmetry.dll ..\\..\\bin\\ /Y",
"copy release\\SDL2.dll ..\\..\\bin\\ /Y",
"copy release\\soloud_x64.dll ..\\..\\bin\\ /Y",
"copy release\\newton.dll ..\\..\\bin\\ /Y",
"rmdir release\\assets",
"mklink /D release\\assets ..\\..\\..\\assets"
}
configuration {"windows", "Debug", "vs2017"}
postbuildcommands
{
"copy ..\\..\\lib\\windows\\sdl2\\SDL2.dll debug\\ /Y",
"copy ..\\..\\lib\\windows\\soloud\\soloud_x64_d.dll debug\\ /Y",
"copy ..\\..\\lib\\windows\\newton\\newton_d.dll debug\\ /Y",
"rmdir debug\\assets",
"mklink /D debug\\assets ..\\..\\..\\assets"
}
-------------------------
-- libSymmetry
-------------------------
project "Library"
kind "SharedLib"
language "C"
targetname "Symmetry"
defines {"GAME_LIB", "USE_GLAD"}
includedirs {"../include/common"}
files { "../src/common/**.c", "../src/common/**.h", "../src/libsymmetry/**.h", "../src/libsymmetry/**.c" }
configuration "windows"
targetname "libSymmetry"
configuration {"windows", "vs2017"}
includedirs {"../include/windows/sdl2/"}
flags "NoImportLib"
configuration {"linux"}
includedirs {"../include/linux/sdl2/"}
configuration "Debug"
defines {"GL_DEBUG_CONTEXT"}

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -4,7 +4,7 @@
// String type based on array that is conveniently resizable and
// converatble to/from other types.
char* str_new(const char* str);
size_t str_len(const char* str);
//char* str_new(const char* str);
//size_t str_len(const char* str);
#endif

@ -47,6 +47,12 @@ enum Sound_Attenuation_Type
SA_EXPONENTIAL // Exponential distance attenuation model
};
struct Physics_Api
{
void(*init)(void);
void(*cleanup)(void);
};
struct Sound_Api
{
void (*update_3d)(void);
@ -142,11 +148,12 @@ struct Platform_Api
void* (*load_function_gl)(const char* name);
void (*reload_game_lib)(void);
struct Window_Api window;
struct Sound_Api sound;
struct File_Api file;
struct Config_Api config;
struct Log_Api log;
struct Window_Api window;
struct Sound_Api sound;
struct File_Api file;
struct Config_Api config;
struct Log_Api log;
struct Physics_Api physics;
};
struct Game_Api

@ -4,6 +4,7 @@
#include "../common/log.h"
#include "sound.h"
#include "platform.h"
#include "physics.h"
#include "file_io.h"
#include "config_vars.h"
#include "../common/hashmap.h"
@ -118,8 +119,14 @@ int main(int argc, char** args)
.log =
{
.file_handle_get = &log_file_handle_get
}
},
.physics =
{
.init = &physics_init,
.cleanup = &physics_cleanup
}
};
if(!game_lib_load())
log_error("main", "Failed to load game library");
else
@ -221,7 +228,7 @@ bool init(void)
return true;
}
void cleanup()
void cleanup(void)
{
if(game.cleanup) game.cleanup();
if(game_lib_handle) platform_unload_library(game_lib_handle);

@ -0,0 +1,27 @@
#include "physics.h"
#include "../common/log.h"
#include <Newton.h>
static NewtonWorld* newton_world = 0;
void physics_init(void)
{
newton_world = NewtonCreate();
if(!newton_world)
{
log_error("physics:init", "Physics world created!");
}
else
{
log_message("Physics world created");
}
}
void physics_cleanup(void)
{
if(newton_world)
{
NewtonDestroy(newton_world);
}
}

@ -0,0 +1,7 @@
#ifndef PHYSICS_H
#define PHYSICS_H
void physics_init(void);
void physics_cleanup(void);
#endif

@ -25,6 +25,7 @@
#include "gui.h"
#include "editor.h"
#include "sprite.h"
#include "../common/string_utils.h"
#include "../common/parser.h"
#include "../common/hashmap.h"
#include "../common/variant.h"
@ -96,6 +97,7 @@ bool game_init(struct Window* window, struct Platform_Api* platform_api)
light_init();
material_init();
entity_init();
platform->physics.init();
scene_init();
/* Debug scene setup */
@ -106,132 +108,128 @@ bool game_init(struct Window* window, struct Platform_Api* platform_api)
void scene_setup(void)
{
// struct Entity* player = scene_add_new("player", ET_CAMERA);
// game_state->player_node = player->id;
// vec3 viewer_pos = {10, 5, 100};
// transform_set_position(player, &viewer_pos);
// int render_width, render_height;
// render_width = 1024;
// render_height = 768;
// camera_create(player, render_width, render_height);
// camera_attach_fbo(player, render_width, render_height, 1, 1, 1);
// vec4_fill(&player->camera.clear_color, 0.3f, 0.6f, 0.9f, 1.0f);
// vec4 color = {1.f, 1.f, 1.f, 1.f };
// struct Entity* new_ent = scene_add_new("Model_Entity", ET_STATIC_MESH);
// vec3 position = {0, 0, -5};
// transform_translate(new_ent, &position, TS_WORLD);
// new_ent->renderable = true;
// model_create(new_ent, "default.pamesh", "Blinn_Phong");
// model_set_material_param(new_ent, "diffuse_color", &color);
// int tex = texture_create_from_file("white.tga", TU_DIFFUSE);
// model_set_material_param(new_ent, "diffuse_texture", &tex);
// vec3 scale = {1, 1, 1};
// transform_scale(new_ent, &scale);
// /* struct Entity* sound_ent = scene_add_as_child("Sound_ENT", ET_SOUND_SOURCE, new_ent->id); */
// /* struct Sound_Source* sound_source = &sound_ent->sound_source; */
// /* platform->sound.source_create(true, 1, &sound_source->source_handle, &sound_source->buffer_handles[0]); */
// /* platform->sound.source_load_wav(sound_source->source_handle, */
// /* sound_source->buffer_handles[0], */
// /* "BigExplosion.wav"); */
// /* //sound_source_relative_set(source, true); */
// /* platform->sound.source_volume_set(sound_source->source_handle, 1.f); */
// /* platform->sound.source_loop_set(sound_source->source_handle, true); */
// /* platform->sound.source_play(sound_source->source_handle); */
// int parent_node = new_ent->id;
// int num_suz = 10;
// srand(time(NULL));
// for(int i = 0; i < num_suz; i++)
// {
// int x = rand() % num_suz;
// int y = rand() % num_suz;
// int z = rand() % num_suz;
// x++; y++; z++;
// struct Entity* suz = scene_add_as_child("Suzanne", ET_STATIC_MESH, parent_node);
// //struct Entity* suz = scene_add_new("Suzanne", ET_STATIC_MESH);
// suz->renderable = true;
// model_create(suz, "default.pamesh", "Blinn_Phong");
// model_set_material_param(suz, "diffuse_color", &color);
// float spec_str = 80.f;
// model_set_material_param(suz, "specular_strength", &spec_str);
// vec3 s_pos = {x, 0, z};
// transform_translate(suz, &s_pos, TS_WORLD);
// }
// struct Entity* ground = scene_add_new("Ground", ET_STATIC_MESH);
// ground->renderable = true;
// model_create(ground, "default.pamesh", "Blinn_Phong");
// model_set_material_param(ground, "diffuse_color", &color);
// int white_tex = texture_create_from_file("white.tga", TU_DIFFUSE);
// model_set_material_param(ground, "diffuse_texture", &white_tex);
// float spec_str = 80.f;
// model_set_material_param(ground, "specular_strength", &spec_str);
// vec3 pos = {0, -5, 0};
// vec3 scale_ground = {400.f, 2.f, 400.f};
// transform_set_position(ground, &pos);
// transform_scale(ground, &scale_ground);
// /* struct Entity* screen = scene_add_new("Screen", NULL); */
// /* struct Model* screen_model = entity_component_add(screen, C_MODEL, NULL, NULL); */
// /* screen_model->geometry_index = geom_find("Quad"); */
// /* struct Entity* screen_camera = scene_add_as_child("Screen_Camera", NULL, screen->node); */
// /* struct Transform* screen_camera_tran = entity_component_get(screen_camera, C_TRANSFORM); */
// /* transform_rotate(screen_camera_tran, &UNIT_Y, 180.f, TS_WORLD); */
// /* struct Camera* cam = entity_component_add(screen_camera, C_CAMERA, 50, 50); */
// /* cam->nearz = 0.1f; */
// /* cam->farz = 50.f; */
// /* camera_update_proj(cam); */
// /* camera_attach_fbo(cam, 128, 128, 1, 1, 0); */
// /* model_set_material_param(screen_model, "diffuse_color", &color); */
// /* model_set_material_param(screen_model, "diffuse_texture", &cam->render_tex); */
// const int MAX_LIGHTS = 3;
// for(int i = 0; i < MAX_LIGHTS; i++)
// {
// int x = rand() % MAX_LIGHTS;
// int z = rand() % MAX_LIGHTS;
// x++; z++;
// struct Entity* light_ent = scene_add_new("Light_Ent", ET_LIGHT);
// vec3 lt_pos = {x * 20, 0, z * 20};
// transform_set_position(light_ent, &lt_pos);
// light_create(light_ent, LT_POINT);
// vec3_fill(&light_ent->light.color, 1.f / (float)x, 1.f / ((rand() % 10) + 1.f), 1.f / (float)z);
// light_ent->light.intensity = 1.f;
// }
// ///* log_message("Sizeof Entity : %d", sizeof(struct Entity)); */
// ///* struct Entity* light_ent = entity_find("Ground"); */
// ///* entity_save(light_ent, "ground.ent", DT_INSTALL); */
// //scene_save("test.symtres", DIRT_INSTALL);
// //struct Entity* light = entity_load("light.ent", DT_INSTALL);
// struct Entity* suz = entity_find("Suzanne");
// struct Entity* sound_ent = scene_add_as_child("Sound_Ent", ET_SOUND_SOURCE, suz->id);
// struct Sound_Source* sound_source = &sound_ent->sound_source;
// sound_source->source_filename = str_new("sounds/teh_beatz.wav");
// sound_source->type = ST_WAV;
// sound_source->attenuation_type = SA_LINEAR;
// sound_source->rolloff_factor = 0.95f;
// sound_source->loop = true;
// sound_source->volume = 1.f;
// sound_source->min_distance = 1.f;
// sound_source->max_distance = 50.f;
// sound_source->playing = true;
// sound_source->source_instance = 0;
// sound_source->source = NULL;
// entity_apply_sound_params(sound_ent);
// scene_save("parser_write.symtres", DIRT_INSTALL);
if(scene_load("parser_write.symtres", DIRT_INSTALL))
// struct Entity* player = scene_add_new("player", ET_CAMERA);
// game_state->player_node = player->id;
// vec3 viewer_pos = {10, 5, 100};
// transform_set_position(player, &viewer_pos);
// int render_width, render_height;
// render_width = 1024;
// render_height = 768;
// camera_create(player, render_width, render_height);
// camera_attach_fbo(player, render_width, render_height, 1, 1, 1);
// vec4_fill(&player->camera.clear_color, 0.3f, 0.6f, 0.9f, 1.0f);
// vec4 color = {1.f, 1.f, 1.f, 1.f };
// struct Entity* new_ent = scene_add_new("Model_Entity", ET_STATIC_MESH);
// vec3 position = {0, 0, -5};
// transform_translate(new_ent, &position, TS_WORLD);
// new_ent->renderable = true;
// model_create(new_ent, "default.pamesh", "Blinn_Phong");
// model_set_material_param(new_ent, "diffuse_color", &color);
// int tex = texture_create_from_file("white.tga", TU_DIFFUSE);
// model_set_material_param(new_ent, "diffuse_texture", &tex);
// vec3 scale = {1, 1, 1};
// transform_scale(new_ent, &scale);
// /* struct Entity* sound_ent = scene_add_as_child("Sound_ENT", ET_SOUND_SOURCE, new_ent->id); */
// /* struct Sound_Source* sound_source = &sound_ent->sound_source; */
// /* platform->sound.source_create(true, 1, &sound_source->source_handle, &sound_source->buffer_handles[0]); */
// /* platform->sound.source_load_wav(sound_source->source_handle, */
// /* sound_source->buffer_handles[0], */
// /* "BigExplosion.wav"); */
// /* //sound_source_relative_set(source, true); */
// /* platform->sound.source_volume_set(sound_source->source_handle, 1.f); */
// /* platform->sound.source_loop_set(sound_source->source_handle, true); */
// /* platform->sound.source_play(sound_source->source_handle); */
// int parent_node = new_ent->id;
// int num_suz = 10;
// srand(time(NULL));
// for(int i = 0; i < num_suz; i++)
// {
// int x = rand() % num_suz;
// int y = rand() % num_suz;
// int z = rand() % num_suz;
// x++; y++; z++;
// struct Entity* suz = scene_add_as_child("Suzanne", ET_STATIC_MESH, parent_node);
// //struct Entity* suz = scene_add_new("Suzanne", ET_STATIC_MESH);
// suz->renderable = true;
// model_create(suz, "default.pamesh", "Blinn_Phong");
// model_set_material_param(suz, "diffuse_color", &color);
// float spec_str = 80.f;
// model_set_material_param(suz, "specular_strength", &spec_str);
// vec3 s_pos = {x, 0, z};
// transform_translate(suz, &s_pos, TS_WORLD);
// }
// struct Entity* ground = scene_add_new("Ground", ET_STATIC_MESH);
// ground->renderable = true;
// model_create(ground, "default.pamesh", "Blinn_Phong");
// model_set_material_param(ground, "diffuse_color", &color);
// int white_tex = texture_create_from_file("white.tga", TU_DIFFUSE);
// model_set_material_param(ground, "diffuse_texture", &white_tex);
// float spec_str = 80.f;
// model_set_material_param(ground, "specular_strength", &spec_str);
// vec3 pos = {0, -5, 0};
// vec3 scale_ground = {400.f, 2.f, 400.f};
// transform_set_position(ground, &pos);
// transform_scale(ground, &scale_ground);
// /* struct Entity* screen = scene_add_new("Screen", NULL); */
// /* struct Model* screen_model = entity_component_add(screen, C_MODEL, NULL, NULL); */
// /* screen_model->geometry_index = geom_find("Quad"); */
// /* struct Entity* screen_camera = scene_add_as_child("Screen_Camera", NULL, screen->node); */
// /* struct Transform* screen_camera_tran = entity_component_get(screen_camera, C_TRANSFORM); */
// /* transform_rotate(screen_camera_tran, &UNIT_Y, 180.f, TS_WORLD); */
// /* struct Camera* cam = entity_component_add(screen_camera, C_CAMERA, 50, 50); */
// /* cam->nearz = 0.1f; */
// /* cam->farz = 50.f; */
// /* camera_update_proj(cam); */
// /* camera_attach_fbo(cam, 128, 128, 1, 1, 0); */
// /* model_set_material_param(screen_model, "diffuse_color", &color); */
// /* model_set_material_param(screen_model, "diffuse_texture", &cam->render_tex); */
// const int MAX_LIGHTS = 3;
// for(int i = 0; i < MAX_LIGHTS; i++)
// {
// int x = rand() % MAX_LIGHTS;
// int z = rand() % MAX_LIGHTS;
// x++; z++;
// struct Entity* light_ent = scene_add_new("Light_Ent", ET_LIGHT);
// vec3 lt_pos = {x * 20, 0, z * 20};
// transform_set_position(light_ent, &lt_pos);
// light_create(light_ent, LT_POINT);
// vec3_fill(&light_ent->light.color, 1.f / (float)x, 1.f / ((rand() % 10) + 1.f), 1.f / (float)z);
// light_ent->light.intensity = 1.f;
// }
/////* log_message("Sizeof Entity : %d", sizeof(struct Entity)); */
/////* struct Entity* light_ent = entity_find("Ground"); */
/////* entity_save(light_ent, "ground.ent", DT_INSTALL); */
// struct Entity* suz = entity_find("Suzanne");
// struct Entity* sound_ent = scene_add_as_child("Sound_Ent", ET_SOUND_SOURCE, suz->id);
// struct Sound_Source* sound_source = &sound_ent->sound_source;
//sound_source->source_filename = str_new("sounds/teh_beatz.wav");
// sound_source->type = ST_WAV;
// sound_source->attenuation_type = SA_LINEAR;
// sound_source->rolloff_factor = 0.95f;
// sound_source->loop = true;
// sound_source->volume = 1.f;
// sound_source->min_distance = 1.f;
// sound_source->max_distance = 50.f;
// sound_source->playing = true;
// sound_source->source_instance = 0;
// sound_source->source = NULL;
// entity_apply_sound_params(sound_ent);
// scene_save("test_scene.symtres", DIRT_INSTALL);
if(scene_load("test_scene.symtres", DIRT_INSTALL))
{
log_message("Scene loaded!");
struct Entity* player = entity_find("player");
@ -1678,7 +1676,11 @@ void game_cleanup(void)
game_state = NULL;
}
if(platform) free(platform);
if(platform)
{
platform->physics.cleanup();
free(platform);
}
}
struct Game_State* game_state_get(void)

@ -14,8 +14,8 @@ static int root_node = -1;
void scene_init(void)
{
/* Add root node to scene */
/* struct Entity* root = entity_create("ROOT", ET_ROOT, -1); */
/* root_node = root->id; */
/*struct Entity* root = entity_create("ROOT", ET_ROOT, -1);
root_node = root->id; */
}
struct Entity* scene_add_new(const char* name, const int type)

Loading…
Cancel
Save