вторник, 24 августа 2010 г.

Editor features



New features added to Glow engine editor during last week. Previously, all level geometry was created in 3ds max and imported into game engine. It's not convenient (and not cheap) way of editing game level, so development of Editor was started.

After week it has next features - drag and drop meshes from Explorer (currently OBJ format, more later), simple Asset manager, executed as job (in parallel thread), so parsing 3d meshes will not stop UI.

Also Undo/Redo is implemented ( with boost functors ). Currently it works for move/rotate/scale, delete/insert, select. Objects can be linked to landscape, so, for example, building and trees will be always on the ground. Rotation, movement will be in local or world coordinate system.

Next things to implement: building level, attaching scripts to objects, assigning materials by drag and drop from Windows Explorer.

среда, 4 августа 2010 г.

Long time ago i wrote function, which creates quaternion for rotation from 0,0,1 to any unit vector. Function was very long, contained asin, acos, several conditions etc... So today i returned and after some time:

// dir should be unit
void Quaternion::from_direction(const vec3& dir)
{
x = dir.y;
y = -dir.x;
z = 0;
w = 1 + dir.z; // simplified dot product with 0,0,1

normalize();
};

понедельник, 2 августа 2010 г.

Editor UI

Finally returned to editor development.
Editor UI will be written by Lua scripts.

I started my UI from simple and usable source of Recast library,
For example, button usage:

if ( imguiButton("Start game") )
LoadLevel("super-duper mega Quake level.mdl")

this is button creation, displaying and logic in one place. After
years on Windows it was amazing!

I mapped API into Lua script language by luabind library, and
now UI script code looks like here:

if object_selected then
rollout( "Object", 0, 0, width, height )
show_object_properties()

if collapse("physics", true, true) then
show_physics_properties()
end
if collapse("visual", true, true) then
show_visual_properties()
end

if collapse("script", true, true) then
show_object_script()
end
end_rollout()

end