summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 56fcde8)
raw | patch | inline | side by side (parent: 56fcde8)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 21 Aug 2017 23:21:29 +0000 (02:21 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Mon, 21 Aug 2017 23:59:15 +0000 (02:59 +0300) |
src/game/g_console.pas | patch | blob | history | |
src/game/g_game.pas | patch | blob | history | |
src/game/g_map.pas | patch | blob | history | |
src/game/g_window.pas | patch | blob | history |
diff --git a/src/game/g_console.pas b/src/game/g_console.pas
index 3c2e7aa4420f2ee156c2f2fbf37e61e60bbb6ed7..8ce21672eefc219b83daf63e470340afc792e893 100644 (file)
--- a/src/game/g_console.pas
+++ b/src/game/g_console.pas
//AddCommand('pf_update_frame', ProfilerCommands);
AddCommand('pf_coldet', ProfilerCommands, 'draw collision detection profiles');
AddCommand('r_sq_draw', ProfilerCommands, 'accelerated spatial queries in rendering');
- AddCommand('r_sq_use_grid', ProfilerCommands, 'use grid for render acceleration');
- AddCommand('r_sq_use_tree', ProfilerCommands, 'use tree for render acceleration');
- AddCommand('dbg_sq_coldet', ProfilerCommands, 'accelerated spatial queries in map coldet');
+ //AddCommand('r_sq_use_grid', ProfilerCommands, 'use grid for render acceleration');
+ //AddCommand('r_sq_use_tree', ProfilerCommands, 'use tree for render acceleration');
+ AddCommand('cd_sq_enabled', ProfilerCommands, 'accelerated spatial queries in map coldet');
- AddCommand('t_dump_node_queries', ProfilerCommands);
+ //AddCommand('t_dump_node_queries', ProfilerCommands);
- AddCommand('sq_use_grid', ProfilerCommands, 'use grid for map coldet acceleration');
- AddCommand('sq_use_tree', ProfilerCommands, 'use tree for map coldet acceleration');
+ //AddCommand('sq_use_grid', ProfilerCommands, 'use grid for map coldet acceleration');
+ //AddCommand('sq_use_tree', ProfilerCommands, 'use tree for map coldet acceleration');
AddCommand('mon_sq_enabled', ProfilerCommands, 'use accelerated spatial queries for monsters');
AddCommand('wtrace_sq_enabled', ProfilerCommands, 'use accelerated weapon hitscan trace');
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index fb5d978bc793a5152d9648cde712bb3a75de5d7a..e4f7afea5da959741fbb7a5b0af47bfaaf2a99b1 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
exit;
end;
- if cmd = 'dbg_sq_coldet' then
+ if cmd = 'cd_sq_enabled' then
begin
case getBool(1) of
-1: begin end;
exit;
end;
+ {
if (cmd = 'sq_use_grid') or (cmd = 'sq_use_tree') then
begin
gdbg_map_use_tree_coldet := (cmd = 'sq_use_tree');
if gdbg_map_use_tree_draw then g_Console_Add('render acceleration: tree') else g_Console_Add('render acceleration: grid');
exit;
end;
+ }
+ {
if (cmd = 't_dump_node_queries') then
begin
case getBool(1) of
if gdbg_map_dump_coldet_tree_queries then g_Console_Add('grid coldet tree queries: tan') else g_Console_Add('grid coldet tree queries: ona');
exit;
end;
+ }
if (cmd = 'mon_sq_enabled') then
begin
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index d4fbcf1830150dc64250d74e257e790b0635fc5b..ae230c2292dfb483875b2c03468d20fde04bbbb5 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
gdbg_map_use_accel_render: Boolean = true;
gdbg_map_use_accel_coldet: Boolean = true;
- gdbg_map_use_tree_draw: Boolean = false;
- gdbg_map_use_tree_coldet: Boolean = false;
- gdbg_map_dump_coldet_tree_queries: Boolean = false;
+ //gdbg_map_use_tree_draw: Boolean = false;
+ //gdbg_map_use_tree_coldet: Boolean = false;
+ //gdbg_map_dump_coldet_tree_queries: Boolean = false;
profMapCollision: TProfiler = nil; //WARNING: FOR DEBUGGING ONLY!
gDrawPanelList: TBinaryHeapObj = nil; // binary heap of all walls we have to render, populated by `g_Map_CollectDrawPanels()`
type
TPanelGrid = specialize TBodyGridBase<TPanel>;
+ {
TDynAABBTreePanelBase = specialize TDynAABBTreeBase<TPanel>;
TDynAABBTreeMap = class(TDynAABBTreePanelBase)
function getFleshAABB (out aabb: AABB2D; pan: TPanel; tag: Integer): Boolean; override;
end;
+ {
+{
function TDynAABBTreeMap.getFleshAABB (out aabb: AABB2D; pan: TPanel; tag: Integer): Boolean;
begin
result := false;
if not aabb.valid then raise Exception.Create('wutafuuuuuuu?!');
result := true;
end;
+}
function panelTypeToTag (panelType: Word): Integer;
FlagPoints: Array [FLAG_RED..FLAG_BLUE] of PFlagPoint;
//DOMFlagPoints: Array of TFlagPoint;
gMapGrid: TPanelGrid = nil;
- mapTree: TDynAABBTreeMap = nil;
+ //mapTree: TDynAABBTreeMap = nil;
procedure g_Map_ProfilersBegin ();
pan.tag := tag;
if not pan.visvalid then continue;
gMapGrid.insertBody(pan, pan.X, pan.Y, pan.Width, pan.Height, tag);
- mapTree.insertObject(pan, tag, true); // as static object
+ //mapTree.insertObject(pan, tag, true); // as static object
end;
end;
begin
gMapGrid.Free();
gMapGrid := nil;
- mapTree.Free();
- mapTree := nil;
+ //mapTree.Free();
+ //mapTree := nil;
calcBoundingBox(gWalls);
calcBoundingBox(gRenderBackgrounds);
e_WriteLog(Format('map dimensions: (%d,%d)-(%d,%d)', [mapX0, mapY0, mapX1, mapY1]), MSG_WARNING);
gMapGrid := TPanelGrid.Create(mapX0, mapY0, mapX1-mapX0+1, mapY1-mapY0+1);
- mapTree := TDynAABBTreeMap.Create();
+ //mapTree := TDynAABBTreeMap.Create();
addPanelsToGrid(gWalls, PANEL_WALL);
addPanelsToGrid(gWalls, PANEL_CLOSEDOOR);
addPanelsToGrid(gBlockMon, PANEL_BLOCKMON);
gMapGrid.dumpStats();
- e_WriteLog(Format('tree depth: %d; %d nodes used, %d nodes allocated', [mapTree.computeTreeHeight, mapTree.nodeCount, mapTree.nodeAlloced]), MSG_NOTIFY);
- mapTree.forEachLeaf(nil);
+ //e_WriteLog(Format('tree depth: %d; %d nodes used, %d nodes allocated', [mapTree.computeTreeHeight, mapTree.nodeCount, mapTree.nodeAlloced]), MSG_NOTIFY);
+ //mapTree.forEachLeaf(nil);
end;
function g_Map_Load(Res: String): Boolean;
begin
gMapGrid.Free();
gMapGrid := nil;
- mapTree.Free();
- mapTree := nil;
+ //mapTree.Free();
+ //mapTree := nil;
Result := False;
gMapInfo.Map := Res;
dplClear();
//tagmask := panelTypeToTag(PanelType);
- if gdbg_map_use_tree_draw then
+ {if gdbg_map_use_tree_draw then
begin
mapTree.aabbQuery(x0, y0, wdt, hgt, checker, (GridTagBack or GridTagStep or GridTagWall or GridTagDoor or GridTagAcid1 or GridTagAcid2 or GridTagWater or GridTagFore));
end
- else
+ else}
begin
gMapGrid.forEachInAABB(x0, y0, wdt, hgt, checker, (GridTagBack or GridTagStep or GridTagWall or GridTagDoor or GridTagAcid1 or GridTagAcid2 or GridTagWater or GridTagFore));
end;
@@ -2129,11 +2133,11 @@ procedure g_Map_DrawPanelShadowVolumes(lightX: Integer; lightY: Integer; radius:
end;
begin
- if gdbg_map_use_tree_draw then
+ {if gdbg_map_use_tree_draw then
begin
mapTree.aabbQuery(lightX-radius, lightY-radius, radius*2, radius*2, checker, (GridTagWall or GridTagDoor));
end
- else
+ else}
begin
gMapGrid.forEachInAABB(lightX-radius, lightY-radius, radius*2, radius*2, checker, (GridTagWall or GridTagDoor));
end;
if (profMapCollision <> nil) then profMapCollision.sectionBeginAccum('*solids');
if gdbg_map_use_accel_coldet then
begin
- if gdbg_map_use_tree_coldet then
+ {if gdbg_map_use_tree_coldet then
begin
//e_WriteLog(Format('coldet query: x=%d; y=%d; w=%d; h=%d', [X, Y, Width, Height]), MSG_NOTIFY);
result := (mapTree.aabbQuery(X, Y, Width, Height, checker, tagmask) <> nil);
g_Console_Add(Format('map collision: %d nodes visited (%d deep)', [mapTree.nodesVisited, mapTree.nodesDeepVisited]));
end;
end
- else
+ else}
begin
result := gMapGrid.forEachInAABB(X, Y, Width, Height, checker, tagmask);
end;
if gdbg_map_use_accel_coldet then
begin
texid := TEXTURE_NONE;
- if gdbg_map_use_tree_coldet then
+ {if gdbg_map_use_tree_coldet then
begin
mapTree.aabbQuery(X, Y, Width, Height, checker, (GridTagWater or GridTagAcid1 or GridTagAcid2));
end
- else
+ else}
begin
gMapGrid.forEachInAABB(X, Y, Width, Height, checker, (GridTagWater or GridTagAcid1 or GridTagAcid2));
end;
diff --git a/src/game/g_window.pas b/src/game/g_window.pas
index 7d9ec78b5baffe5a78bb694e1c15008af40eeb53..ac9c9c6bd8e6f11b398b194b199570418df918ed 100644 (file)
--- a/src/game/g_window.pas
+++ b/src/game/g_window.pas
if ParamStr(idx) = '--opengl-dump-exts' then gwin_dump_extensions := true;
if ParamStr(idx) = '--twinkletwinkle' then gwin_k8_enable_light_experiments := true;
if ParamStr(idx) = '--jah' then g_profile_history_size := 100;
- if ParamStr(idx) = '--tree-draw' then gdbg_map_use_tree_draw := true;
- if ParamStr(idx) = '--grid-draw' then gdbg_map_use_tree_draw := false;
- if ParamStr(idx) = '--tree-coldet' then gdbg_map_use_tree_coldet := true;
- if ParamStr(idx) = '--grid-coldet' then gdbg_map_use_tree_coldet := false;
+ //if ParamStr(idx) = '--tree-draw' then gdbg_map_use_tree_draw := true;
+ //if ParamStr(idx) = '--grid-draw' then gdbg_map_use_tree_draw := false;
+ //if ParamStr(idx) = '--tree-coldet' then gdbg_map_use_tree_coldet := true;
+ //if ParamStr(idx) = '--grid-coldet' then gdbg_map_use_tree_coldet := false;
end;
- if gdbg_map_use_tree_draw then e_WriteLog('using TREE renderer', MSG_NOTIFY);
- if not gdbg_map_use_tree_draw then e_WriteLog('using GRID renderer', MSG_NOTIFY);
+ //if gdbg_map_use_tree_draw then e_WriteLog('using TREE renderer', MSG_NOTIFY);
+ //if not gdbg_map_use_tree_draw then e_WriteLog('using GRID renderer', MSG_NOTIFY);
- if gdbg_map_use_tree_coldet then e_WriteLog('using TREE coldet', MSG_NOTIFY);
- if not gdbg_map_use_tree_coldet then e_WriteLog('using GRID coldet', MSG_NOTIFY);
+ //if gdbg_map_use_tree_coldet then e_WriteLog('using TREE coldet', MSG_NOTIFY);
+ //if not gdbg_map_use_tree_coldet then e_WriteLog('using GRID coldet', MSG_NOTIFY);
e_WriteLog('Initializing OpenGL', MSG_NOTIFY);
InitOpenGL(gVSync);