You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.
Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.
#ZPC DISABLE ERROR LINE REPORTING
* @section Sprites are images that are rendered to the screen without any perspective projection and as such appear pixel-perfect. As such it is an unnecessary waste of VRAM to autogenerate mip maps for an
* image you will only use for sprites.
* The sprites are drawn on top of any 3D; labels are sprites with a priority value of 0 that are placed into the GUI sprite layer by default, making them be drawn on top of all normal sprites,
* as well as other GUI components.
* @title DX11 CREATE SPRITE
* @desc Creates a sprite from an image and positions it at the given screen coordinates.
* Note that this will setup an internal dependency on the image, meaning that it will not be deleted until the Sprite is deleted too.
* Also note that if several sprites have the same internal- and layer priority, the draw order will be static (in other words, no flickering) but the
* order between the sprites with the same priority cannot be known prior to runtime.
* @param DWORD image - The source image
* @param INTEGER x - The X screen coordinate to put the Sprite's left edge at
* @param INTEGER y - The Y screen coordinate to put the Sprite's top edge at
* @oparam WORD priority - A draw priority to assign to this sprite. Sprites are drawn back to front and a higher priority means it gets drawn earlier. Defaults to <i>1</i> which means the sprite will be drawn last.
* @oparam DWORD layer - A sprite layer to put this sprite in. Defaults to DX11 GET DEFAULT SPRITE LAYER() which has a layer priority of 1, making its contents draw on top of all but sprites in the GUI layer.
* @returns DWORD - The created sprite
function LN(x as float)
` Green Gandalf's natural log function
` accurate to about 6 decimal places
` (unless x is VERY large or small)
` written 20 May 2007, amended 21 May 2007
` NOTE - no checks for valid x values yet!!
` create memblock for float to dword conversion,
` replace 99 by another convenient memblock number if necessary,
` runs slightly faster if memblock is created in main program
` and following line removed
if memblock exist(99) = 0 then make memblock 99, 4
` split x into exponent and mantissa
d as dword
mant as dword
expon as integer
write memblock float 99, 0, x
d = memblock dword(99, 0)
` magic bit constants based on information provided by IanM
expon=((%01111111100000000000000000000000&&d)>>23) - 127
write memblock dword 99, 0, mant
` x should be in the range 1.0 to 2.0
x = memblock float( 99, 0)
` adjust range to 1/sqrt(2) to sqrt(2) for accuracy
if x > 1.414213562
x = x / 2.0
` calculate series approximation to LN(x)
arg# = (x - 1.0)/(x + 1.0)
arg2# = arg# * arg#
sum# = 1.0
fac# = 2.0 * arg#
arg# = arg2#
div# = 3.0
for i = 1 to 2 ` upper limit of 3 is slightly slower and more accurate
inc sum#, arg2#/div#
inc div#, 2.0
arg2# = arg2# * arg#
result# = sum# * fac# + expon * 0.69314718
dx11 set sync mask 1 << dx11 get camera id(mainCam)
dx11 set sync mask 0 << dx11 get camera id(mainCam)
dx11 render camera cam
dx11 init SCREEN_WIDTH, SCREEN_HEIGHT, false, "DX11 Plugin Example: Screen quad", DXVERSION_10_0
dx11 init SCREEN_WIDTH, SCREEN_HEIGHT, true, "DX11 Plugin Example: Screen quad", DXVERSION_10_0
Login to post a reply