Coffei
Community Member

Posts: 12
|
 |
« Reply #6 on: January 10, 2007, 11:41:30 AM » |
|
Ok.. I really don't know what to do, so i post my code here:
Option Strict Off Option Explicit On Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.Show() Kamera = New TrueVision3D.TVCamera Engine = New TrueVision3D.TVEngine Land = New TrueVision3D.TVLandscape Atmo = New TrueVision3D.TVAtmosphere Inp = New TrueVision3D.TVInputEngine TextFac = New TrueVision3D.TVTextureFactory Scena = New TrueVision3D.TVScene Sound = New TV3DMedia.TVSoundEngine Grafic = New TrueVision3D.TVGraphicEffect
Engine.SetDebugFile("C:/Debugator.txt")
Engine.Init3DWindowedMode(Me.Handle.ToInt32) Engine.DisplayFPS = True Engine.SetAngleSystem(TrueVision3D.CONST_TV_ANGLE.TV_ANGLE_DEGREE)
TextFac.LoadBumpTexture( path to texture , "Sky") TextFac.LoadTexture( path to texture , "Zem") TextFac.LoadTexture( path to texture , "Skydyna")
Scena.SetMipMappingPrecision(-4) Scena.SetViewFrustum(90, 100000) Scena.SetTextureFilter(TrueVision3D.CONST_TV_TEXTUREFILTER.TV_FILTER_ANISOTROPIC)
Land.GenerateHugeTerrain( path to heightmap , TrueVision3D.CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, 10, 10, 0, 0, True) Land.SetTexture(TrueVision3DTVGlobals_definst.GetTex("Zem")) Land.SetTextureScale(10, 10, -1) Land.InitClouds(TrueVision3DTVGlobals_definst.GetTex("Skydyna"), TrueVision3D.CONST_TV_LAND_CLOUDMODE.TV_CLOUD_MOVE, 250, 1, 1, 1, 1, 2048) Land.SetCloudVelocity(1, 0.1, 0.1)
Atmo.SkyBox_Enable(True) Scena.SetSceneBackGround(0.4, 0.6, 0.9)
sngPositionX = 0 sngPositionY = 20 sngPositionZ = 0 snglookatX = 0 snglookatY = 20 snglookatZ = 50 sngAngleX = 0 sngAngleY = 0
Walk = 0 Strafe = 0 loopign = True
Do_looping()
End Sub ______________________________________________________________________________________________________________________________
Private Sub Do_looping() Do System.Windows.Forms.Application.DoEvents() If Inp.IsKeyPressed(TrueVision3D.CONST_TV_KEY.TV_KEY_ESCAPE) = True Then looping = False End If
Input_check()
Input_do()
Engine.Clear()
Atmo.Atmosphere_Render()
Scena.RenderAllMeshes()
Engine.RenderToScreen() Loop Until looping = True
Quit_main() End Sub ____________________________________________________________________________________________________________________________
Private Sub Input_check() With Inp If .IsKeyPressed(TrueVision3D.CONST_TV_KEY.TV_KEY_W) = True Then Walk = 1
ElseIf .IsKeyPressed(TrueVision3D.CONST_TV_KEY.TV_KEY_S) = True Then Walk = -1 End If
If .IsKeyPressed(TrueVision3D.CONST_TV_KEY.TV_KEY_A) = True Then Strafe = -1 ElseIf .IsKeyPressed(TrueVision3D.CONST_TV_KEY.TV_KEY_D) = True Then Strafe = 1 End If
Dim tmpMouseX, tmpMouseY As Integer Dim tmpMouseB2, tmpMouseB1, tmpMouseB3 As Short Dim tmpMouseScrollOld, tmpMouseScrollNew As Integer tmpMouseScrollOld = tmpMouseScrollNew .GetMouseState(tmpMouseX, tmpMouseY, tmpMouseB1, tmpMouseB2, tmpMouseB3, tmpMouseScrollNew)
sngAngleX = sngAngleX - (tmpMouseY / 100) sngAngleY = sngAngleY - (tmpMouseX / 100) End With End Sub
Private Sub Input_do() If sngAngleX > 1.3 Then sngAngleX = 1.3 If sngAngleX < -1.3 Then sngAngleX = -1.3
sngPositionX = sngPositionX + (System.Math.Cos(sngAngleY) * Walk / 5) + (System.Math.Cos(sngAngleY + 3.141596 / 2) * Strafe / 5 * Engine.TimeElapsed) sngPositionZ = sngPositionZ + (System.Math.Sin(sngAngleY) * Walk / 5) + (System.Math.Sin(sngAngleY + 3.141596 / 2) * Strafe / 5 * Engine.TimeElapsed) sngPositionY = 10
snglookatX = sngPositionX + System.Math.Cos(sngAngleY) snglookatY = sngPositionY + System.Math.Tan(sngAngleX) snglookatZ = sngPositionZ + System.Math.Sin(sngAngleY)
Kamera.SetPosition(sngPositionX, sngPositionY, sngPositionZ) Kamera.SetRotation(snglookatX, snglookatY, snglookatZ) End Sub
_______________________________________________________________________________________________________________________________ Private Sub Quit_main() Here I destroy everything what i declared before...
End Sub End Class
It's long, but I'm really amater, so i don't know what do you want see... PLEASE help..
|