Jump to content

Au3Irrlicht 2.0


JRowe
 Share

Recommended Posts

Ok, this is scary, my nvidia GTX275 makes wierd whiny noises when running this stuff ;)

Anyone else experiencing this ?

I prolly dont dare trying anymore if it pops my gfx card :)

I can play huge games like crysis and farcry2 without any noise, but this makes my card cry.

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

Ok, this is scary, my nvidia GTX275 makes wierd whiny noises when running this stuff ;)

Anyone else experiencing this ?

I prolly dont dare trying anymore if it pops my gfx card :)

I can play huge games like crysis and farcry2 without any noise, but this makes my card cry.

I am not getting any noise... However you might try switching the driver tht is being used. There are three goodones that come with this. Take a look at _IRRStart, odds are your using $IRR_EDT_OPENGL, Try cahnging that to $IRR_EDT_DIRECT3D9 or $IRR_EDT_DIRECT3D8. That may solve your problem. Also go to nvidia and download the latest drivers, it could just be your driver is out of date and it is working overtime to compensate. Works fine on my nvidia Geforce 7800.

Edited by fireryblaze
Link to comment
Share on other sites

Anyone else experiencing this ?

Nope - first time hearing this. The Irrlicht engine doing all the "magic" behind the au3Irr2 wrapper is widely used, so this will be a specific hardware/software thing I guess - updating drivers is always a good idea (but gamers usually have latest ones ;) ).

Maybe you can try examples of the original irrlicht engine to encircle the problem?

And: anybody else out there with this GFX? Same problems or not?

Link to comment
Share on other sites

Aight Version 3 of my tutorial/project thingy is now out and shows how to alternate between 2 scenes Via a Distance trigger(Get to close to the teleporter mat and you get sent to the other scene).

A link to the thread can be found here Please leave feedback

OT: WOW my post count has been rising lateley...

Edited by fireryblaze
Link to comment
Share on other sites

Array returning x/y/z values of node position. From example 13:

; get the position of the camera into the three supplied variables
    dim $a_vector3df[3]
    _IrrGetNodePosition($CameraNode, $a_vector3df)

    ; create a wide string with a list of the positions in
    $metrics = "POSITION " & round($a_vector3df[0],0) & " " & round($a_vector3df[1],0) & " " & round($a_vector3df[2],0) & "              "
Link to comment
Share on other sites

Hi,

Thank you for the great library of functions.

Can you also add the function _IrrDraw2DImageElementStretch() when you get the time.

Example and Function:

; Includes for extension libraries
#include <au3Irrlicht2.au3>

_IrrStart()

Local $hLogo = _IrrGetTexture("./media/Cross.bmp")

; Use White as Alpha color
_IrrColorKeyTexture($hLogo, 255, 255, 255)

While _IrrRunning() And Sleep(10)

    _IrrBeginScene(255, 255, 0)

    ; Draw Original texture just to see what the unchanged texture looks like.
    _IrrDraw2DImage($hLogo, 0, 0)

    ;Draw texture smaller using Alpha beside the original.
    _IrrDraw2DImageElementStretch($hLogo, 128, 0, 192, 64, 0, 0, 128, 128, $IRR_USE_ALPHA)

    ;Draw texture Larger using Alpha beside the previous smaller texture.
    _IrrDraw2DImageElementStretch($hLogo, 192, 0, 448, 256, 0, 0, 128, 128, $IRR_USE_ALPHA)

    ;Draw beside Larger texture quarter of source texture to new larger destination not using Alpha.
    _IrrDraw2DImageElementStretch($hLogo, 448, 0, 800, 352, 0, 0, 64, 64, $IRR_IGNORE_ALPHA)

    _IrrEndScene()
WEnd

_IrrStop()

; #FUNCTION# =============================================================================================================
; Name...........: _IrrDraw2DImageElementStretch
; Description ...: Draws specified rectangle from Source texture sizing it to fit the specified Desination rectangle.
; Syntax.........: _IrrDraw2DImageElementStretch($h_Texture, $i_DestTopX, $i_DestTopY, $i_DestBottomX, $i_DestBottomY, $i_SourceTopX, $i_SourceTopY, $i_SourceBottomX, $i_SourceBottomY, $i_UseAlpha)
; Parameters ....: $h_Texture - Handle to an irrlicht image object
;                  $i_DestTopX - Top X Destination where the drawing will start.
;                  $i_DestTopY - Top Y Destination where the drawing will start.
;                  $i_DestBottomX - Bottom X Destination where the drawing will end.
;                  $i_DestBottomY - Bottom Y Destination where the drawing will end.
;                  $i_SourceTopX - X top position of rectangle in the source texture
;                  $i_SourceTopY - Y top position of rectangle in the source texture
;                  $i_SourceBottomX - X bottom position of rectangle in the source texture
;                  $i_SourceBottomY - Y bottom position of rectangle in the source texture
;                  $i_UseAlpha - Whether or not to use the alpha channel should be one of the following values:
;                  |$IRR_IGNORE_ALPHA
;                  |$IRR_USE_ALPHA
; Return values .: Success - True
;                  Failure - False
; Author ........:
; Modified.......:
; Remarks .......: The image is copied from the specified rectangle in the source texture, this enables you to put many images onto a single texture.
;                  If the rectangles are different sizes this function will scale the images appropriately.
;                  This function also supports the alpha channel when drawing the image to the display and can draw the image transparently.
; Related .......: _IrrGetTexture, _IrrColorKeyTexture
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _IrrDraw2DImageElementStretch($h_Texture, $i_DestTopX, $i_DestTopY, $i_DestBottomX, $i_DestBottomY, $i_SourceTopX, $i_SourceTopY, $i_SourceBottomX, $i_SourceBottomY, $i_UseAlpha)
    DllCall($_irrDll, "none:cdecl", "IrrDraw2DImageElementStretch", "ptr", $h_Texture, "int", $i_DestTopX, "int", $i_DestTopY, "int", $i_DestBottomX, "int", $i_DestBottomY, "int", $i_SourceTopX, "int", $i_SourceTopY, "int", $i_SourceBottomX, "int", $i_SourceBottomY, "int", $i_UseAlpha)
    Return SetError(@error, 0, @error = 0)
EndFunc   ;==>_IrrDraw2DImageElementStretch
Cheers Edited by smashly
Link to comment
Share on other sites

Hi,

Had a go at another minor function _IrrGetTextureInformation()

But I didn't implement the return as the original wrapper mentioned.

Your spose to pass the empty variables for each param and the function fills the variables.

So I could of used ByRef for each param, but the way the call works in autoit, it seemed better to just return an array with the four elements.

; Includes for extension libraries
#include <au3Irrlicht2.au3>

_IrrStart()

Local $hLogo = _IrrGetTexture("./media/Cross.bmp")

Local $aInfo = _IrrGetTextureInformation($hLogo)
If Not @error Then _
        MsgBox(64, "Texture Information", "Width: " & $aInfo[0] & @LF & "Height: " & $aInfo[1] & @LF & "Pitch: " & $aInfo[2] & @LF & "Color Format: " & $aInfo[3])

_IrrStop()

; #FUNCTION# =============================================================================================================
; Name...........: _IrrGetTextureInformation
; Description ...: Get information on a texture. The width, height, pitch and color format is returned in an array.
; Syntax.........: _IrrGetTextureInformation($h_Texture)
; Parameters ....: $h_Texture - Handle to an irrlicht texture object
; Return values .: Success - 1D Array with the information
;                  |$Array[0] = Width of the texture
;                  |$Array[1] = Height of the texture
;                  |$Array[2] = Pitch of the texture
;                  |$Array[3] = Color Reference of the texture (eg: $ECF_A1R5G5B5, $ECF_R5G6B5, $ECF_R8G8B8, $ECF_A8R8G8B8)
;                  Failure - Empty Array and Sets @error to 1
; Author ........:
; Modified.......:
; Remarks .......: This function will Hard Crash AutoIt if an Invalid $h_Texture is passed to the function.
; Related .......: _IrrGetTexture
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _IrrGetTextureInformation($h_Texture)
    Local $aResult, $aReturn[4]
    $aResult = DllCall($_irrDll, "none:cdecl", "IrrGetTextureInformation", "ptr", $h_Texture, "uint*", 0, "uint*", 0, "uint*", 0, "int*", 0)
    If @error Or UBound($aResult) <> 6 Then Return SetError(1, 0, $aReturn)
    For $i = 2 To 5
        $aReturn[$i - 2] = $aResult[$i]
    Next
    Return SetError(0, 0, $aReturn)
EndFunc   ;==>_IrrGetTextureInformation
Cheers
Link to comment
Share on other sites

Hi smashly, thanks again, seems I have to add you to credits ... Your help is definetly welcome, especially because I am currently not on the 2D include. If you like to add some more functions (I hope you'll do ;) ), you can check latest dev version directly from the project page. I've updated files yesterday, so very up-to-date status (Of course more comfort if you check the complete thing out with a subversion client).

BTW: Think remark in IrrGetTextureInformation's header is not needed (or we'll have to add it inside help for almost every au3Irr2 function using handles :) - it's unfortunately a limitation of au3 that we cannot create type-safe functions, especially when dealing with a lot of different pointer types)

Link to comment
Share on other sites

Hi again and your welcome,

Not sure If I should just keep posting functions in the thread?

Should I be submitting them another way?

But anyways another simple function for Keyboard Mouse Management section.

_IrrGetAbsoluteMousePosition()

#include <au3Irrlicht2.au3>

Global $aGAMP

_IrrStart()

While _IrrRunning() And Sleep(10)

    $aGAMP = _IrrGetAbsoluteMousePosition()
    _IrrSetWindowCaption("Absolute Mouse Poition - X: " & $aGAMP[0] & " Y: " & $aGAMP[1])

WEnd

_IrrStop()

; #FUNCTION# =============================================================================================================
; Name...........: _IrrGetAbsoluteMousePosition
; Description ...: Get the absolute mouse X and Y position
; Syntax.........: _IrrGetAbsoluteMousePosition()
; Parameters ....: None.
; Return values .: success - 1D Array containing absolute mouse position.
;                  |$Array[0] = X position of the mouse
;                  |$Array[1] = Y position of the mouse
;                  failure - Empty 1D Array and Set @error 1
; Author ........:
; Modified.......:
; Remarks .......:
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _IrrGetAbsoluteMousePosition()
    Local $aResult, $aReturn[2]
    $aResult = DllCall($_irrDll, "none:cdecl", "IrrGetAbsoluteMousePosition", "int*", 0, "int*", 0)
    If @error Or Not IsArray($aResult) Then Return SetError(1, 0, $aReturn)
    $aReturn[0] = $aResult[1]
    $aReturn[1] = $aResult[2]
    Return SetError(0, 0, $aReturn)
EndFunc   ;==>_IrrGetAbsoluteMousePosition
Cheers
Link to comment
Share on other sites

Not sure If I should just keep posting functions in the thread?

Should I be submitting them another way?

Depends – if you have only some small corrections you can send me a PM (or to jRowe, but I think compared to him I have currently some more time for this).

If you have several things, it’s easier to maintain the sources if you collect a little bit, then send .zip with modified files/added files. Then I can compare/check/integrate you’re your changes more easily.

If you are interested in working on au3Irr2 regularly, it may also become senseful to give you write access to project page, but I prefer some organisation before so it’s possible to manage different people’s work without running out of control. Makes no sense when everybody starts to add into (and over!) what he believe it’s the best …

Hope Jrowe agrees with this ;)

edit: integrated your contributions so they will be in next release. Thanks!

Edited by linus
Link to comment
Share on other sites

Hi,

Just a quick edit to _IrrSetTextureCreationFlag() function with an example.

The Flag and Value params were the wrong way around.

I was able to check this because of the _IrrGetTextureInformation() function I posted earlier ;)

#include <au3Irrlicht2.au3>

; Constants for 2D Management TEXTURE_CREATION_FLAG, needs to be added to au3Irr2_Constants.au3
Global Const $ETCF_ALWAYS_16_BIT = 0x00000001
Global Const $ETCF_ALWAYS_32_BIT = 0x00000002
Global Const $ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004
Global Const $ETCF_OPTIMIZED_FOR_SPEED = 0x00000008
Global Const $ETCF_CREATE_MIP_MAPS = 0x00000010
Global Const $ETCF_NO_ALPHA_CHANNEL = 0x00000020

;Example Start
Global $hTexture, $aInfo

_IrrStart()

; Set the Texture creation flag to load textures in 16 bit without alpha (R5G6B5 format)
_IrrSetTextureCreationFlag(BitOR($ETCF_ALWAYS_16_BIT, $ETCF_NO_ALPHA_CHANNEL), $IRR_ON)

; Load a texture
$hTexture = _IrrGetTexture("./media/cross.bmp")

; query some info about the loaded texture, index 3 of the returned array is Color Reference
$aInfo = _IrrGetTextureInformation($hTexture)

; show the color format in a string to see the Texture creation flag was set
MsgBox(64, "Texture color format", _TextureFormatString($aInfo[3]))

_IrrStop()

; just for the example.
Func _TextureFormatString($iValue)
    Local $sMsg
    Switch $iValue
        Case $ECF_R5G6B5
            $sMsg &= "R5G6B5 - 16 bit without alpha channel"
        Case $ECF_A1R5G5B5
            $sMsg &= "A1R5G5B5 - 16 bit with alpha channel"
        Case $ECF_R8G8B8
            $sMsg &= "R8G8B8 - 24 bit without alpha channel"
        Case $ECF_A8R8G8B8
            $sMsg &= "A8R8G8B8 - 32 bit with alpha channel"
        Case Else
            $sMsg &= "Unknown"
    EndSwitch
    Return $sMsg
EndFunc   ;==>_TextureFormatString

; example end

; function has been changed, the $i_Value, $i_Flag are now in their correct position within the dll call
; _Edit has been appended to the end of the function just so this example can run.. Remove it when updating au3Irr2_2D.au3
;
; #FUNCTION# =============================================================================================================
; Name...........: _IrrSetTextureCreationFlag
; Description ...: Sets texture creation flags controlling how textures are handled when they are created.
; Syntax.........: _IrrSetTextureCreationFlag($i_Flag, $i_Value)
; Parameters ....: $i_Value -  The following flags can be set;
;                  |$ETCF_ALWAYS_16_BIT - Forces the driver to always create 16 bit textures, independently of which format the file on disk has.
;                   When choosing this you may loose some color detail, but gain speed and save memory.
;                   16 bit textures can be transferred twice as quickly as 32 bit textures and only use half of the memory space.
;                   When using this flag, it does not make sense to use the flags ETCF_ALWAYS_32_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or ETCF_OPTIMIZED_FOR_SPEED at the same time.
;                  |$ETCF_ALWAYS_32_BIT - Forces the driver to always create 32 bit textures, independently of which format the file on disk has.
;                   Note that some drivers (like the software device) will ignore this, because they are only able to create and use 16 bit textures.
;                   When using this flag, it does not make sense to use the flags ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or ETCF_OPTIMIZED_FOR_SPEED at the same time.
;                  |$ETCF_OPTIMIZED_FOR_QUALITY - Lets the driver decide in which format the textures are created and tries to make the textures look as good as possible.
;                   Usually it simply chooses the format in which the texture was stored on disk.
;                   When using this flag, it does not make sense to use the flags ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_SPEED at the same time.
;                  |$ETCF_OPTIMIZED_FOR_SPEED - Lets the driver decide in which format the textures are created and tries to create them maximizing render speed.
;                   When using this flag, it does not make sense to use the flags ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_QUALITY, at the same time.
;                  |$ETCF_CREATE_MIP_MAPS - Automatically creates mip map levels for the textures.
;                  |$ETCF_NO_ALPHA_CHANNEL - Discard any alpha layer and use non-alpha color format.
;                  $i_Flag - Turn Creation Flag Off or On ($IRR_OFF or $IRR_ON)
; Return values .: Success - True
;                  Failure - False
; Author ........:
; Modified.......:
; Remarks .......:
; Related .......: [todo: functionName, functionName]
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _IrrSetTextureCreationFlag_Edit($i_Value, $i_Flag) ; Remove _Edit
    DllCall($_irrDll, "none:cdecl", "IrrSetTextureCreationFlag", "int", $i_Value, "int", $i_Flag)
    Return SetError(@error, 0, @error = 0)
EndFunc   ;==>_IrrSetTextureCreationFlag_Edit


; Function already added in 2.04 release
Func _IrrGetTextureInformation($h_Texture)
    Local $aResult, $aReturn[4]
    $aResult = DllCall($_irrDll, "none:cdecl", "IrrGetTextureInformation", "ptr", $h_Texture, "uint*", 0, "uint*", 0, "uint*", 0, "int*", 0)
    If @error Or UBound($aResult) <> 6 Then Return SetError(1, 0, $aReturn)
    For $i = 2 To 5
        $aReturn[$i - 2] = $aResult[$i]
    Next
    Return SetError(0, 0, $aReturn)
EndFunc   ;==>_IrrGetTextureInformation

Cheers

Edited by smashly
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...