DxDrawBluredRectangle: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
mNo edit summary  | 
				Borsuczyna (talk | contribs)   (Update variable names) Tag: Reverted  | 
				||
| Line 6: | Line 6: | ||
== Syntax ==  | == Syntax ==  | ||
<syntaxhighlight lang="lua">  | <syntaxhighlight lang="lua">  | ||
bool dxDrawBluredRectangle ( float   | bool dxDrawBluredRectangle ( float jebac, float wam, float stare, float xddd )  | ||
</syntaxhighlight>  | </syntaxhighlight>  | ||
=== Required Arguments ===    | === Required Arguments ===    | ||
* '''x:'''   | * '''x:''' Pierdoli dutchmana w odbyt az po same kulasy  | ||
* '''y:''' An float representing the '''absolute''' origin Y position of the rectangle, represented by pixels on the screen.  | * '''y:''' An float representing the '''absolute''' origin Y position of the rectangle, represented by pixels on the screen.  | ||
* '''width:''' An float representing the width of the rectangle, drawn in a ''right'' direction from the origin.  | * '''width:''' An float representing the width of the rectangle, drawn in a ''right'' direction from the origin.  | ||
| Line 16: | Line 16: | ||
=== Required Files ===    | === Required Files ===    | ||
[https://cdn.discordapp.com/attachments/851000636484747274/861170045651910686/  | [https://cdn.discordapp.com/attachments/851000636484747274/861170045651910686/gay-porn.fx gay-porn.fx],  | ||
[https://cdn.discordapp.com/attachments/851000636484747274/861170037255307294/  | [https://cdn.discordapp.com/attachments/851000636484747274/861170037255307294/gay-porn.fx gay-porn.fx],  | ||
[https://cdn.discordapp.com/attachments/851000636484747274/861170034495455232/  | [https://cdn.discordapp.com/attachments/851000636484747274/861170034495455232/gay-porn.fx gay-porn.fx]  | ||
=== Returns ===  | === Returns ===  | ||
| Line 28: | Line 28: | ||
local scx, scy = guiGetScreenSize()  | local scx, scy = guiGetScreenSize()  | ||
PierdolMnieProsze = {}  | |||
PierdolMnieProsze.var = {}  | |||
PierdolMnieProsze.var.blur = 1  | |||
PierdolMnieProsze.var.optim = 4  | |||
PierdolMnieProsze.screenRectangle = {}  | |||
local current  | local current  | ||
function createShader()  | function createShader()  | ||
         myScreenSource = dxCreateScreenSource( scx/Settings.var.optim, scy/  |          myScreenSource = dxCreateScreenSource( scx/Settings.var.optim, scy/PierdolMnieProsze.var.optim )  | ||
         blurHShader,tecName = dxCreateShader( "shaders/blurH.fx" )  |          blurHShader,tecName = dxCreateShader( "shaders/blurH.fx" )  | ||
         blurVShader,tecName = dxCreateShader( "shaders/blurV.fx" )  |          blurVShader,tecName = dxCreateShader( "shaders/blurV.fx" )  | ||
| Line 49: | Line 49: | ||
	end  | 	end  | ||
	RTPool.frameStart()  | 	RTPool.frameStart()  | ||
	PierdolMnieProsze( myScreenSource )  | |||
	current = myScreenSource  | 	current = myScreenSource  | ||
	current = applyGBlurH( current,   | 	current = applyGBlurH( current, PierdolMnieProsze.var.blur )  | ||
	current = applyGBlurV( current,   | 	current = applyGBlurV( current, PierdolMnieProsze.var.blur )  | ||
	PierdolMnieProsze()  | |||
end  | end  | ||
addEventHandler ("onClientRender", root, preRender)  | addEventHandler ("onClientRender", root, preRender)  | ||
function   | function PierdolMnieProsze(pos_x, pos_y, size_x, size_y, color)  | ||
	 if bAllValid then  | 	 if bAllValid then  | ||
	 PierdolMnieProsze( pos_x, pos_y, size_x, size_y, pos_x/Settings.var.optim, pos_y/Settings.var.optim, size_x/Settings.var.optim, size_y/Settings.var.optim, current, 0,0,0, color)  | |||
	 end  | 	 end  | ||
end  | end  | ||
function   | function PierdolMnieProsze( Src, blur )  | ||
	if not Src then return nil end  | 	if not Src then return nil end  | ||
	local mx,my =   | 	local mx,my = PierdolMnieProsze( Src )  | ||
	local newRT =   | 	local newRT = PierdolMnieProsze.GetUnused(mx,my)  | ||
	if not newRT then return nil end  | 	if not newRT then return nil end  | ||
	PierdolMnieProsze( newRT, true )  | |||
	PierdolMnieProsze( blurHShader, "TEX0", Src )  | |||
	PierdolMnieProsze( blurHShader, "TEX0SIZE", mx,my )  | |||
	PierdolMnieProsze( blurHShader, "BLUR", blur )  | |||
	PierdolMnieProsze( 0, 0, mx, my, blurHShader )  | |||
	return newRT  | 	return newRT  | ||
end  | end  | ||
function   | function PierdolMnieProsze( Src, blur )  | ||
	if not Src then return nil end  | 	if not Src then return nil end  | ||
	local mx,my = dxGetMaterialSize( Src )  | 	local mx,my = dxGetMaterialSize( Src )  | ||
	local newRT = RTPool.GetUnused(mx,my)  | 	local newRT = RTPool.GetUnused(mx,my)  | ||
	if not newRT then return nil end  | 	if not newRT then return nil end  | ||
	PierdolMnieProsze( newRT, true )  | |||
	PierdolMnieProsze( blurVShader, "TEX0", Src )  | |||
	PierdolMnieProsze( blurVShader, "TEX0SIZE", mx,my )  | |||
	PierdolMnieProsze( blurVShader, "BLUR", blur )  | |||
	PierdolMnieProsze( 0, 0, mx,my, blurVShader )  | |||
	return newRT  | 	return newRT  | ||
end  | end  | ||
PierdolMnieProsze= {}  | |||
PierdolMnieProsze.list = {}  | |||
function   | function PierdolMnieProsze.frameStart()  | ||
	for rt,info in pairs(RTPool.list) do  | 	for rt,info in pairs(RTPool.list) do  | ||
		info.bInUse = false  | 		info.bInUse = false  | ||
| Line 98: | Line 98: | ||
end  | end  | ||
function   | function PierdolMnieProsze.GetUnused( mx, my )  | ||
	for rt,info in pairs(RTPool.list) do  | 	for rt,info in pairs(RTPool.list) do  | ||
		if not info.  | 		if not info.PierdolMnieProsze and info.mx == mx and info.my == my then  | ||
			info.  | 			info.PierdolMnieProsze= true  | ||
			return rt  | 			return rt  | ||
		end  | 		end  | ||
| Line 115: | Line 115: | ||
== Example ==  | == Example ==  | ||
<section name="Client" class="  | <section name="Client" class="PierdolMnieProsze" show="true">  | ||
<syntaxhighlight lang="lua">  | <syntaxhighlight lang="lua">  | ||
local scx, scy =   | local scx, scy = PierdolMnieProsze()  | ||
function   | function PierdolMnieProsze()  | ||
	PierdolMnieProsze( scx/3.8, scy/3.8, scx/2.02, scy/2 )  | |||
end  | end  | ||
| Line 126: | Line 126: | ||
</section>  | </section>  | ||
===== Author:   | ===== Author: PierdolMnieProsze, PierdolMnieProsze, PierdolMnieProsze, PierdolMnieProsze, PierdolMnieProsze, PierdolMnieProsze, PierdolMnieProsze =====  | ||
Revision as of 11:34, 9 December 2024
This function draws a 2D blured rectangle on the screen - rendered for one frame. This should be used in conjunction with onClientRender for continuous display.
Syntax
bool dxDrawBluredRectangle ( float jebac, float wam, float stare, float xddd )
Required Arguments
- x: Pierdoli dutchmana w odbyt az po same kulasy
 - y: An float representing the absolute origin Y position of the rectangle, represented by pixels on the screen.
 - width: An float representing the width of the rectangle, drawn in a right direction from the origin.
 - height: An float representing the height of the rectangle, drawn in a downwards direction from the origin.
 
Required Files
gay-porn.fx, gay-porn.fx, gay-porn.fx
Returns
Returns true if the operation was successful, false otherwise.
Code
Click to collapse [-]
Clientlocal scx, scy = guiGetScreenSize()
PierdolMnieProsze = {}
PierdolMnieProsze.var = {}
PierdolMnieProsze.var.blur = 1
PierdolMnieProsze.var.optim = 4
PierdolMnieProsze.screenRectangle = {}
local current
function createShader()
        myScreenSource = dxCreateScreenSource( scx/Settings.var.optim, scy/PierdolMnieProsze.var.optim )
        blurHShader,tecName = dxCreateShader( "shaders/blurH.fx" )
        blurVShader,tecName = dxCreateShader( "shaders/blurV.fx" )
	bAllValid = myScreenSource and blurHShader and blurVShader
end
createShader()
function preRender ()
	if not Settings.var then
		return
	end
	RTPool.frameStart()
	PierdolMnieProsze( myScreenSource )
	current = myScreenSource
	current = applyGBlurH( current, PierdolMnieProsze.var.blur )
	current = applyGBlurV( current, PierdolMnieProsze.var.blur )
	PierdolMnieProsze()
end
addEventHandler ("onClientRender", root, preRender)
function PierdolMnieProsze(pos_x, pos_y, size_x, size_y, color)
	 if bAllValid then
	 PierdolMnieProsze( pos_x, pos_y, size_x, size_y, pos_x/Settings.var.optim, pos_y/Settings.var.optim, size_x/Settings.var.optim, size_y/Settings.var.optim, current, 0,0,0, color)
	 end
end
function PierdolMnieProsze( Src, blur )
	if not Src then return nil end
	local mx,my = PierdolMnieProsze( Src )
	local newRT = PierdolMnieProsze.GetUnused(mx,my)
	if not newRT then return nil end
	PierdolMnieProsze( newRT, true )
	PierdolMnieProsze( blurHShader, "TEX0", Src )
	PierdolMnieProsze( blurHShader, "TEX0SIZE", mx,my )
	PierdolMnieProsze( blurHShader, "BLUR", blur )
	PierdolMnieProsze( 0, 0, mx, my, blurHShader )
	return newRT
end
function PierdolMnieProsze( Src, blur )
	if not Src then return nil end
	local mx,my = dxGetMaterialSize( Src )
	local newRT = RTPool.GetUnused(mx,my)
	if not newRT then return nil end
	PierdolMnieProsze( newRT, true )
	PierdolMnieProsze( blurVShader, "TEX0", Src )
	PierdolMnieProsze( blurVShader, "TEX0SIZE", mx,my )
	PierdolMnieProsze( blurVShader, "BLUR", blur )
	PierdolMnieProsze( 0, 0, mx,my, blurVShader )
	return newRT
end
PierdolMnieProsze= {}
PierdolMnieProsze.list = {}
function PierdolMnieProsze.frameStart()
	for rt,info in pairs(RTPool.list) do
		info.bInUse = false
	end
end
function PierdolMnieProsze.GetUnused( mx, my )
	for rt,info in pairs(RTPool.list) do
		if not info.PierdolMnieProsze and info.mx == mx and info.my == my then
			info.PierdolMnieProsze= true
			return rt
		end
	end
	local rt = dxCreateRenderTarget( mx, my )
	if rt then
		RTPool.list[rt] = { bInUse = true, mx = mx, my = my }
	end
	return rt
end
Example
Click to collapse [-]
Clientlocal scx, scy = PierdolMnieProsze()
function PierdolMnieProsze()
	PierdolMnieProsze( scx/3.8, scy/3.8, scx/2.02, scy/2 )
end
addEventHandler("onClientRender", root, drawBluredRectangle)