index 3d2befe2b9808707f47fea4143b95ff09c4a7d12..ebfdda5676d4d9a088a55cf14b2ee890cc829360 100644 (file)
uses
{$INCLUDE ../nogl/noGLuses.inc}
+{$IFDEF ENABLE_HOLMES}
+ g_holmes,
+{$ENDIF}
SysUtils, Classes, Math,
- e_graphics,
+ g_base, r_graphics,
g_system, g_touch,
MAPDEF, xprofiler, utils, wadreader,
g_textures, e_input, e_sound,
- g_language, g_console, g_menu, g_triggers, g_player, g_options, g_monsters, g_map, g_panel, g_window,
+ g_language, g_console, g_menu, g_triggers, g_player, g_options, g_monsters, g_map, g_panel,
g_items, g_weapons, g_gfx, g_phys, g_net, g_gui, g_netmaster,
g_game, r_console, r_gfx, r_items, r_map, r_panel, r_monsters, r_weapons, r_netmaster, r_player
;
else e_Clear(GL_COLOR_BUFFER_BIT, 0, 0, 0);
end;
-procedure DrawMinimap(p: TPlayer; RenderRect: e_graphics.TRect);
+procedure DrawMinimap(p: TPlayer; RenderRect: TRect);
var
a, aX, aY, aX2, aY2, Scale, ScaleSz: Integer;
e_AmbientQuad(sX, sY, sWidth, sHeight, ambColor.r, ambColor.g, ambColor.b, ambColor.a);
end;
+// ////////////////////////////////////////////////////////////////////////// //
+var
+ ltexid: GLuint = 0;
+
+function g_Texture_Light (): Integer;
+const
+ Radius: Integer = 128;
+var
+ tex, tpp: PByte;
+ x, y, a: Integer;
+ dist: Double;
+begin
+ if ltexid = 0 then
+ begin
+ GetMem(tex, (Radius*2)*(Radius*2)*4);
+ tpp := tex;
+ for y := 0 to Radius*2-1 do
+ begin
+ for x := 0 to Radius*2-1 do
+ begin
+ dist := 1.0-sqrt((x-Radius)*(x-Radius)+(y-Radius)*(y-Radius))/Radius;
+ if (dist < 0) then
+ begin
+ tpp^ := 0; Inc(tpp);
+ tpp^ := 0; Inc(tpp);
+ tpp^ := 0; Inc(tpp);
+ tpp^ := 0; Inc(tpp);
+ end
+ else
+ begin
+ //tc.setPixel(x, y, Color(cast(int)(dist*255), cast(int)(dist*255), cast(int)(dist*255)));
+ if (dist > 0.5) then dist := 0.5;
+ a := round(dist*255);
+ if (a < 0) then a := 0 else if (a > 255) then a := 255;
+ tpp^ := 255; Inc(tpp);
+ tpp^ := 255; Inc(tpp);
+ tpp^ := 255; Inc(tpp);
+ tpp^ := Byte(a); Inc(tpp);
+ end;
+ end;
+ end;
+
+ glGenTextures(1, @ltexid);
+ //if (tid == 0) assert(0, "VGL: can't create screen texture");
+
+ glBindTexture(GL_TEXTURE_2D, ltexid);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+
+ //GLfloat[4] bclr = 0.0;
+ //glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, bclr.ptr);
+
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Radius*2, Radius*2, 0, GL_RGBA{gltt}, GL_UNSIGNED_BYTE, tex);
+ end;
+
+ result := ltexid;
+end;
// setup sX, sY, sWidth, sHeight, and transformation matrix before calling this!
//FIXME: broken for splitscreen mode