Format
This commit is contained in:
@@ -5,6 +5,6 @@ let project = new Project("test");
|
||||
project.add_project("../../");
|
||||
project.add_tsfiles("sources");
|
||||
project.add_shaders("shaders/*.kong");
|
||||
project.add_assets("assets/*", { destination: "data/{name}" });
|
||||
project.add_assets("assets/*", {destination : "data/{name}"});
|
||||
|
||||
return project;
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
|
||||
function main() {
|
||||
let ops: iron_window_options_t = {
|
||||
title: "Empty",
|
||||
width: 1280,
|
||||
height: 720,
|
||||
x: -1,
|
||||
y: -1,
|
||||
features: window_features_t.RESIZABLE | window_features_t.MINIMIZABLE | window_features_t.MAXIMIZABLE,
|
||||
mode: window_mode_t.WINDOWED,
|
||||
frequency: 60,
|
||||
vsync: true,
|
||||
depth_bits: 32
|
||||
title : "Empty",
|
||||
width : 1280,
|
||||
height : 720,
|
||||
x : -1,
|
||||
y : -1,
|
||||
features : window_features_t.RESIZABLE | window_features_t.MINIMIZABLE | window_features_t.MAXIMIZABLE,
|
||||
mode : window_mode_t.WINDOWED,
|
||||
frequency : 60,
|
||||
vsync : true,
|
||||
depth_bits : 32
|
||||
};
|
||||
sys_start(ops);
|
||||
ready();
|
||||
@@ -26,87 +26,29 @@ function ready() {
|
||||
render_path_commands = render_commands;
|
||||
|
||||
let scene: scene_t = {
|
||||
name: "Scene",
|
||||
objects: [
|
||||
{
|
||||
name: "Cube",
|
||||
type: "mesh_object",
|
||||
data_ref: "cube.arm/Cube",
|
||||
material_ref: "MyMaterial",
|
||||
visible: true,
|
||||
spawn: true
|
||||
},
|
||||
{
|
||||
name: "Camera",
|
||||
type: "camera_object",
|
||||
data_ref: "MyCamera",
|
||||
visible: true,
|
||||
spawn: true
|
||||
}
|
||||
name : "Scene",
|
||||
objects : [
|
||||
{name : "Cube", type : "mesh_object", data_ref : "cube.arm/Cube", material_ref : "MyMaterial", visible : true, spawn : true},
|
||||
{name : "Camera", type : "camera_object", data_ref : "MyCamera", visible : true, spawn : true}
|
||||
],
|
||||
camera_datas: [
|
||||
{
|
||||
name: "MyCamera",
|
||||
near_plane: 0.1,
|
||||
far_plane: 100.0,
|
||||
fov: 0.85
|
||||
}
|
||||
],
|
||||
camera_ref: "Camera",
|
||||
material_datas: [
|
||||
{
|
||||
name: "MyMaterial",
|
||||
shader: "MyShader",
|
||||
contexts: [
|
||||
{
|
||||
name: "mesh",
|
||||
bind_textures: [
|
||||
{
|
||||
name: "my_texture",
|
||||
file: "texture.k"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
shader_datas: [
|
||||
{
|
||||
name: "MyShader",
|
||||
contexts: [
|
||||
{
|
||||
name: "mesh",
|
||||
vertex_shader: "mesh.vert",
|
||||
fragment_shader: "mesh.frag",
|
||||
compare_mode: "less",
|
||||
cull_mode: "clockwise",
|
||||
depth_write: true,
|
||||
vertex_elements: [
|
||||
{
|
||||
name: "pos",
|
||||
data: "short4norm"
|
||||
},
|
||||
{
|
||||
name: "tex",
|
||||
data: "short2norm"
|
||||
}
|
||||
],
|
||||
constants: [
|
||||
{
|
||||
name: "WVP",
|
||||
type: "mat4",
|
||||
link: "_world_view_proj_matrix"
|
||||
}
|
||||
],
|
||||
texture_units: [
|
||||
{
|
||||
name: "my_texture"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
camera_datas : [ {name : "MyCamera", near_plane : 0.1, far_plane : 100.0, fov : 0.85} ],
|
||||
camera_ref : "Camera",
|
||||
material_datas :
|
||||
[ {name : "MyMaterial", shader : "MyShader", contexts : [ {name : "mesh", bind_textures : [ {name : "my_texture", file : "texture.k"} ]} ]} ],
|
||||
shader_datas : [ {
|
||||
name : "MyShader",
|
||||
contexts : [ {
|
||||
name : "mesh",
|
||||
vertex_shader : "mesh.vert",
|
||||
fragment_shader : "mesh.frag",
|
||||
compare_mode : "less",
|
||||
cull_mode : "clockwise",
|
||||
depth_write : true,
|
||||
vertex_elements : [ {name : "pos", data : "short4norm"}, {name : "tex", data : "short2norm"} ],
|
||||
constants : [ {name : "WVP", type : "mat4", link : "_world_view_proj_matrix"} ],
|
||||
texture_units : [ {name : "my_texture"} ]
|
||||
} ]
|
||||
} ]
|
||||
};
|
||||
map_set(data_cached_scene_raws, scene.name, scene);
|
||||
|
||||
@@ -118,8 +60,8 @@ function ready() {
|
||||
function scene_ready() {
|
||||
// Set camera
|
||||
let t: transform_t = scene_camera.base.transform;
|
||||
t.loc = vec4_create(0, -6, 0);
|
||||
t.rot = quat_from_to(vec4_create(0, 0, 1), vec4_create(0, -1, 0));
|
||||
t.loc = vec4_create(0, -6, 0);
|
||||
t.rot = quat_from_to(vec4_create(0, 0, 1), vec4_create(0, -1, 0));
|
||||
transform_build_matrix(t);
|
||||
|
||||
// Rotate cube
|
||||
@@ -131,4 +73,6 @@ function spin_cube() {
|
||||
transform_rotate(cube.transform, vec4_create(0, 0, 1), 0.01);
|
||||
}
|
||||
|
||||
function tr(id: string, vars: map_t<string, string> = null): string { return id; }
|
||||
function tr(id: string, vars: map_t<string, string> = null): string {
|
||||
return id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user