|
|
Line 1: |
Line 1: |
| {{Resource page}}
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| This resource lets You create billboards. Billboard is a quad that always faces the camera.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| In this case billboard Elements are created using dxDrawMaterialLine3d MTA function.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| I have changed the behaviour of the material to act as cylindrical billboards do.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| There are many possibilities to use this resource. But that's all up to you.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| | | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| == Overview ==
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| | | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| It is easy to use, gives a few options to manage billboards.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| | | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| The resource itself adds exported clientside functions:
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| | | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| ==Exported functions==
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| ====createBillboard====
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| <section name="Client" class="client" show="true">
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| This function creates a shadered materialLine3d billboard.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| <syntaxhighlight lang="lua">billboardElement exports.custom_billboards:createBillboard(float posX,posY,posZ,sizeX,sizeY,int colorR,colorG,colorB,colorA)</syntaxhighlight>
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| ===Required Arguments===
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| *'''float posX, posY, posZ:''' Position in world space.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| *'''float sizeX, sizeY:''' Size of the billboard.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| *'''int colorR,colorG,colorB,colorA:''' RGBA color (0 - 255).
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| ===Returns===
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| The function returns billboardElement if set successfully, false otherwise.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| </section>
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| | | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| ====destroyBillboard====
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| <section name="Client" class="client" show="true">
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| This function destroys a shadered materialLine3d billboard element.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| <syntaxhighlight lang="lua">bool exports.custom_billboards:destroyBillboard(element billboardElement)</syntaxhighlight>
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| ===Required Arguments===
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| *'''element billboardElement:''' A previously declared billboard element.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| ===Returns===
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| The function returns true if set successfully, false otherwise.
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| </section>
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| | | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| ====setBillboardMaterial====
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| <section name="Client" class="client" show="true">
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| This function sets the billboard material (ex. texture).
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| <syntaxhighlight lang="lua">bool exports.custom_billboards:setBillboardMaterial(element billboardElement)</syntaxhighlight>
| | Extrem liże hazowi dupsko a Barcioo liże cipsko Trinowi |
| ===Required Arguments===
| |
| *'''element billboardElement:''' A previously declared billboard element.
| |
| ===Returns===
| |
| The function returns true if set successfully, false otherwise.
| |
| </section>
| |
| | |
| ====setBillboardPosition====
| |
| <section name="Client" class="client" show="true">
| |
| This function sets billboard position.
| |
| <syntaxhighlight lang="lua">bool exports.custom_billboards:setbillboardPosition(element billboardElement,float posX,posY,posZ)</syntaxhighlight>
| |
| ===Required Arguments===
| |
| *'''element billboardElement:''' A previously declared billboard element.
| |
| *'''float posX, posY, posZ:''' Position in world space.
| |
| ===Returns===
| |
| The function returns true if set successfully, false otherwise.
| |
| </section>
| |
| | |
| ====setBillboardSize====
| |
| <section name="Client" class="client" show="true">
| |
| This function sets billboard size.
| |
| <syntaxhighlight lang="lua">bool exports.custom_billboards:setBillboardSize(element billboardElement,float size)</syntaxhighlight>
| |
| ===Required Arguments===
| |
| *'''element billboardElement:''' A previously declared billboard element.
| |
| *'''float size:''' Size of the billboard.
| |
| ===Returns===
| |
| The function returns true if set successfully, false otherwise.
| |
| </section>
| |
| | |
| ====setBillboardSizeXY====
| |
| <section name="Client" class="client" show="true">
| |
| This function sets billboard width and height.
| |
| <syntaxhighlight lang="lua">bool exports.custom_billboards:setBillboardSizeXY(element billboardElement,float sizeX,sizeY)</syntaxhighlight>
| |
| ===Required Arguments===
| |
| *'''element billboardElement:''' A previously declared billboard element.
| |
| *'''float sizeX,sizeY:''' The width and height of the billboard.
| |
| ===Returns===
| |
| The function returns true if set successfully, false otherwise.
| |
| </section>
| |
| | |
| ====setBillboardDepthBias====
| |
| <section name="Client" class="client" show="true">
| |
| On createBillboard the depthBias is set properly (0-1). You can however set other value depending on your needs. To see the results you'll need to set enableDepthBiasScale to true.
| |
| <syntaxhighlight lang="lua">bool exports.custom_billboards:setBillboardDepthBias(element billboardElement,float depthBiasValue)</syntaxhighlight>
| |
| ===Required Arguments===
| |
| *'''element billboardElement:''' A previously declared billboard element.
| |
| *'''float depthBiasValue:''' depthBias value.
| |
| ===Returns===
| |
| The function returns true if set successfully, false otherwise.
| |
| </section>
| |
| | |
| ====setBillboardColor====
| |
| <section name="Client" class="client" show="true">
| |
| This function sets light color values.
| |
| <syntaxhighlight lang="lua">bool exports.custom_billboards:setbillboardColor(element billboardElement,float colorR,colorG,colorB,colorA)</syntaxhighlight>
| |
| ===Required Arguments===
| |
| *'''element billboardElement:''' A previously declared billboard element.
| |
| *'''float colorR,colorG,colorB,colorA:''' RGBA color (0 - 255).
| |
| ===Returns===
| |
| The function returns true if set successfully, false otherwise.
| |
| </section>
| |
| | |
| ====setBillboardsDistFade====
| |
| <section name="Client" class="client" show="true">
| |
| Set the Max distance of the billboard to sync and the distance on which the it starts to fade out.
| |
| <syntaxhighlight lang="lua">bool exports.custom_billboards:setBillboardsDistFade(int MaxEffectFade,int MinEffectFade)</syntaxhighlight>
| |
| ===Required Arguments===
| |
| *'''int MaxEffectFade:''' Set the Max distance of the billboard to sync.(Must be greater than MinEffectFade).
| |
| *'''int MinEffectFade:''' Set the distance on which the billboard starts to fade out.
| |
| ===Returns===
| |
| The function returns true if set successfully, false otherwise.
| |
| </section>
| |
| | |
| ====enableDepthBiasScale====
| |
| <section name="Client" class="client" show="true">
| |
| Standard depthBias for GTASA coronas is about 1 unit, despite the corona scale. This function elables depthBias scaling.
| |
| <syntaxhighlight lang="lua">bool exports.custom_billboards:enableDepthBiasScale(bool isDepthScaleEnabled)</syntaxhighlight>
| |
| ===Required Arguments===
| |
| *'''bool isDepthScaleEnabled:''' Enable/disable depthBias scaling.
| |
| ===Returns===
| |
| The function returns true if set successfully, false otherwise.
| |
| </section>
| |
| | |
| ==Examples==
| |
| <syntaxhighlight lang="lua">local tex = dxCreateTexture("hello.jpg")
| |
| function addStuff()
| |
| for i=1,30 do
| |
| for j=1,30 do
| |
| exports.custom_billboards:createBillboard(tex,i * 7,j * 7,10,4,4,math.random()*255,math.random()*255,math.random()*255,1*255)
| |
| end
| |
| end
| |
| end
| |
| | |
| addEventHandler("onClientResourceStart", getResourceRootElement( getThisResource()), addStuff)</syntaxhighlight>
| |
| This creates 400 lovely billboards near position (0,0,0)
| |
| | |
| <syntaxhighlight lang="lua">local vehicle1 = nil
| |
| addEventHandler("onClientVehicleEnter", getRootElement(),
| |
| function(thePlayer, seat)
| |
| if thePlayer == getLocalPlayer() then
| |
| vehicle1 = source
| |
| end
| |
| end
| |
| )
| |
| | |
| local tex = dxCreateTexture("hello.jpg")
| |
| local carLight = exports.custom_billboards:createBillboard(tex,0,0,0,4,4,math.random()*255,math.random()*255,math.random()*255,1*255)
| |
| addEventHandler("onClientPreRender", root, function()
| |
| if vehicle1 then
| |
| xxx1,yyy1,zzz1 = getElementPosition(vehicle1)
| |
| exports.custom_billboards:setBillboardPosition(carLight,xxx1,yyy1,zzz1)
| |
| end
| |
| end
| |
| ) </syntaxhighlight>
| |
| This creates a billboard and attaches it to a vehicle that the player enters.
| |
| | |
| Of course when you want to use these functions in your resources you have to include
| |
| the custom_billboards resource in meta.
| |
| | |
| ==See Also==
| |
| | |
| [http://community.multitheftauto.com/index.php?p=resources&s=details&id=10156 Resource download link]
| |
| | |
| [https://www.dropbox.com/s/vvsvua1kmrpjxaz/custom_billboards_test.zip?dl=0 Test resource]
| |