Hi,
Ich beschäftige mich nun seid langem mit Irrlicht (http://irrlicht.sourceforge.net/) und möchte zu einem Objekt, das ich in Blender (http://www.blender.org/) erstellt habe auch eine Textur haben. Wenn ich jedoch eine Textur wähle, kommt immer bloß die DUrchschnittsfarbe der Textur als Objektfarbe =(
; ----------------------------------------------------------------------------
; Irrlicht Wrapper for Imperative Languages - Freebasic Examples
; Frank Dodd (2006)
; Converted/modified for the au3Irr2 project by linus
; ----------------------------------------------------------------------------
; Example 29 : Skydome
; This example adds a skydome around the whole scene that makes a backdrop
; for your scene to be rendered against
; ----------------------------------------------------------------------------
; ////////////////////////////////////////////////////////////////////////////
; Includes for extension libraries
#include "..\au3Irrlicht2.au3"
HotKeySet("{ESC}", "_exit")
Func _exit()
_IrrStop()
Exit
EndFunc ; _exit
; ////////////////////////////////////////////////////////////////////////////
[/autoit][autoit][/autoit][autoit][/autoit][autoit]; -----------------------------------------------------------------------------
; start the irrlicht interface
_IrrStart( $IRR_EDT_DIRECT3D9, 800, 600, $IRR_BITS_PER_PIXEL_32, _
$IRR_WINDOWED, $IRR_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON )
; send the window caption
_IrrSetWindowCaption( "Skydome Script" )
; the skydome is a simple hollow sphere that surrounds the whole scene. a single
; texture is applied to the entire surface of the sphere. Portions of the sphere
; can be rendered to optimise the performance of the scene
local $SkyDome = _IrrAddSkyDomeToScene( _
_IrrGetTexture("../media/skydome2.jpg"), _
16, 8, 1.0, 1.2)
_IrrAddRotationAnimator($SkyDome, 0, 0.003, 0)
; we add a terrain to the scene for demonstration purposes, for a detailed
; explaination of the process please refer to example 10
local $TerrainNode = _IrrAddTerrain( "../media/terrain-heightmap.bmp" )
_IrrSetNodeScale( $TerrainNode, 100.0, 10.4, 100.0 )
local $TerrainTexture0 = _IrrGetTexture( "../media/terrain-texture.jpg" )
local $TerrainTexture1 = _IrrGetTexture( "../media/detailmap3.jpg" )
_IrrSetNodeMaterialTexture( $TerrainNode, $TerrainTexture0, 0 )
_IrrSetNodeMaterialTexture( $TerrainNode, $TerrainTexture1, 1 )
_IrrScaleTexture( $TerrainNode, 1.0, 60.0 )
_IrrSetNodeMaterialFlag( $TerrainNode, $IRR_EMF_LIGHTING, $IRR_OFF )
_IrrSetNodeMaterialType ( $TerrainNode, $IRR_EMT_DETAIL_MAP )
; we add a first person perspective camera to the scene so you can look about
; and move it into the center of the map
local $Camera = _IrrAddFPSCamera()
_IrrSetNodePosition( $Camera, 3942.8, 1102.7, 5113.9 )
_IrrSetCameraClipDistance( $Camera, 12000 )
$objekt=Add4CObjekt("Form.3ds","default_texture.png")
_IrrSetNodePosition($objekt,3942,1000,5100)
; hide the mouse pointer
_IrrHideMouse()
; -----------------------------------------------------------------------------
; while the irrlicht environment is still running
WHILE _IrrRunning()
; begin the scene, erasing the canvas with sky-blue before rendering
_IrrBeginScene( 240, 255, 255 )
; draw the scene
_IrrDrawScene()
; end drawing the scene and render it
_IrrEndScene()
WEND
; -----------------------------------------------------------------------------
; Stop the irrlicht engine and release resources
_IrrStop()
Func Add4CObjekt($objket,$texture)
$MD2Mesh = _IrrGetMesh( "../media/"&$objket )
$MeshTexture = _IrrGetTexture( "../media/"&$texture )
$SceneNode = _IrrAddMeshToScene( $MD2Mesh )
_IrrSetNodeMaterialTexture( $SceneNode, $MeshTexture, 0 )
_IrrSetNodeMaterialFlag( $SceneNode, $IRR_EMF_LIGHTING, $IRR_ON )
Return $SceneNode
EndFunc
Anmerkungen:
1) Ist das Skydome Beispiel mit meiner Testfunktion zum Objekteinfügen.
2) Objekt erscheint richtig, nur wie erwähnt die Farbe stimmt nicht ganz.
3) Objekt habe ich in Blender erstellt und in 3ds exportiert.
4) Um das Script laufen zu lassen braucht ihr die Irrlicht Dateien!
Hoffe jemand kann helfen!
Lg