Code: Alles auswählen
spUseDirect3D9()
spAppTitle("")
spVsync(#True)
spGraphics3D(1024, 768, 32, #False)
InitCamera(0, 10, -5)
spRotateEntity(Camera\ID, 70, 0,0)
spCameraClsColor(Camera\ID, 100, 100, 100)
Light = spCreateLight()
spPositionEntity(Light,0,20,10)
Obj = spLoadMesh("Data\Tile.3ds")
spScaleEntity(Obj, 2, 2, 2)
ColorMap = spLoadTexture("Data\Grass 001.png")
NormalMap = spLoadTexture("Data\Grass 001 nm.png")
spEntityTexture(Obj, ColorMap ,0 ,0)
spEntityTexture(Obj, NormalMap,0, 1)
spUpdateTangentSpace(Obj)
Global WorldMatrix.i = spCreateMatrix()
Global ViewMatrix.i = spCreateMatrix()
Global ProjectionMatrix.i = spCreateMatrix()
Global BufferMatrix.i = spCreateMatrix()
Global WorldViewProjectionMatrix.i = spCreateMatrix()
Global ShaderTable = spCreateShaderTable()
Global VertexShader = spLoadShader(ShaderTable, #SHADER_VERTEX, #HLSL_VERTEX_3_0, "Data\Shader\BumpMapping.hlsl", "VertexMain")
Global PixelShader = spLoadShader(ShaderTable, #SHADER_PIXEL, #HLSL_PIXEL_3_0, "Data\Shader\BumpMapping.hlsl", "PixelMain")
spShaderTableLink(ShaderTable)
spEntityMatrix(Obj, WorldMatrix)
spEntityMatrix(Camera\ID, ViewMatrix)
spInverseMatrix(ViewMatrix)
spProjectionMatrix(ProjectionMatrix)
spMultMatrix(BufferMatrix, WorldMatrix, ViewMatrix)
spMultMatrix(WorldViewProjectionMatrix, BufferMatrix, ProjectionMatrix)
spSetShaderMat(VertexShader, "WorldMatrix", WorldMatrix)
spSetShaderMat(VertexShader, "WorldViewProjectionMatrix", WorldViewProjectionMatrix)
spSetShaderInt(PixelShader, "EnableBumps", #True)
spSetShaderVec(PixelShader, "Light1_Position", 0,20,10)
spSetShaderVec(PixelShader, "Light1_Diffuse", 5,5,5)
spSetShaderVec(PixelShader, "Light1_Specular", 5,5,5)
spSetShaderFloat(PixelShader, "Light1_Radius", 200.0)
spSetShaderFloat(PixelShader, "Light1_Shininess", 200.0)
spSetShader(Obj, ShaderTable)
Repeat
spEntityMatrix(Obj, WorldMatrix)
spEntityMatrix(Camera\ID, ViewMatrix)
spInverseMatrix(ViewMatrix)
spProjectionMatrix(ProjectionMatrix)
spMultMatrix(BufferMatrix, WorldMatrix, ViewMatrix)
spMultMatrix(WorldViewProjectionMatrix, BufferMatrix, ProjectionMatrix)
spSetShaderMat(VertexShader, "WorldMatrix", WorldMatrix)
spSetShaderMat(VertexShader, "WorldViewProjectionMatrix", WorldViewProjectionMatrix)
spTurnEntity(Obj, 0, 0.25, 0)
spUpdateWorld()
spRenderWorld()
spText(0, 0,Str(spFPS()))
spFlip()
If spKeyDown(#PB_Key_Left)
CameraMove(-0.1, 0, 0)
ElseIf spKeyDown(#PB_Key_Right)
CameraMove( 0.1, 0, 0)
EndIf
If spKeyDown(#PB_Key_Up)
CameraMove(0, 0, 0.1)
ElseIf spKeyDown(#PB_Key_Down)
CameraMove(0, 0, -0.1)
EndIf
If spKeyDown(#PB_Key_A)
CameraMove(0, 0.1, 0)
ElseIf spKeyDown(#PB_Key_Z)
CameraMove(0, -0.1, 0)
EndIf
Until spKeyDown(#PB_Key_Escape)
spEndGraphics()
CloseLibrary(#__SP_LIB__)
End
PS: Im log scheint alles korrekt zu sein, kein fehler da aufgeführt.
Könntest du ein funktionierendes Beispiel zum downloaden machen?
thx Arthur
[EDIT]
Lieber noch die LogFile:
Code: Alles auswählen
SoftPixel Engine - debug log file:
(generated at 03/10/2010 18:54:15)
==================================
SoftPixel Engine - v.2.1
Copyright (c) 2008 - Lukas Hermanns
Microsoft Windows 7 Personal (Build 7600)
Compiled with: Visual C++ 9.0
Using renderer: Direct3D 9.0c
Shader version: HLSL Shader Model 3.0
NVIDIA GeForce 8800 GTS: NVIDIA Corporation
SensitiveSoundSystem - v.3.0
Copyright (c) 2008 - Lukas Hermanns
Using device: WinMM
Load mesh: "Data/Tile.3ds"
Load texture: "Data/"
Error: Could not found texture file!
Load texture: "Data/Grass 001.png"
Load texture: "Data/Grass 001 nm.png"
Load HLSL vertex shader: "Data\Shader\BumpMapping.hlsl"
Load HLSL pixel shader: "Data\Shader\BumpMapping.hlsl"