Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: TV6.5 Tutorial 8 - A complete landscape.  (Read 2864 times)
Dimple
Community Member
*
Posts: 632


« on: September 02, 2009, 06:03:01 PM »

 Huh

Well I'm having some problems with eight lines of code in this Tutorial. I've stared the lines and the error occurs in the code between the *  and the (.
I'll post the full code below that.


' Then, we set everything we can for this water.
    *    Land.SetWaterTexture(Globals.GetTex("Water"))
    *    Land.SetWaterEffect(False, 0.5, True, CONST_TV_BLENDEX.TV_BLENDEX_SRCALPHA, CONST_TV_BLENDEX.TV_BLENDEX_INVSRCALPHA, False)
    *    Land.SetWaterTextureScale(5)
      
      ' We set the water height via a variable. We need this variable
      ' to be able to add an extra underwater fog effect later, at the
      ' rendering.
      sngWaterHeight = 100
   *   Land.SetWaterAltitude(sngWaterHeight)
      
      ' And we finish by enabling the water.
   *   Land.SetWaterEnable(True)
      
      ' New : for fun, we will also add some clouds, just over the water
      ' to give a creepy fog effect. Let's start by loading the clouds textures.
        TextureFactory.LoadTexture("..\..\..\..\Media\clouds.dds", "Clouds", CONST_TV_COLORKEY.TV_COLORKEY_BLACK)
      
      ' Then, set the land's clouds.
   *    Land.InitClouds(Globals.GetTex("Clouds"), CONST_TV_CLOUDMODE.TV_CLOUD_MOVE, 500, 1, 1, 2, 2, 1024)
   *    Land.SetCloudVelocity(1, 0.01, 0.01)
      

And this is in the main loop...


'Light.SetSpecularLightning(False)
        *   Scene.SetSpecularLightning(False)

The message exceeds the maximum allowed length (20000 characters). Again!

will try to post code just under this post...... Rats! The codes to long!! Won't allow the post. Sorry!
« Last Edit: September 02, 2009, 06:07:01 PM by Dimple » Logged

Using VB.NET, TV3D 6.5, Win 7
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
jviper
Community Member
*
Posts: 2131

Discipline in training


« Reply #1 on: September 02, 2009, 06:32:27 PM »

Hmmm, looks like you're missing the Land = Scene.CreateLandscape(......)
Logged

JAbstract.....Don't just imagine, make it happen!
Dimple
Community Member
*
Posts: 632


« Reply #2 on: September 02, 2009, 07:58:50 PM »

 Shocked

Crap! your right I have a two versions of this going, one started with the 6.2 tutorial and the other (this one) from 6.3 sourcecode.  I have that in the other one and not this one, and I didn't even notice. Duh! Thanks!! I'll see if that fixes it and report my findings in this thread. later....


Logged

Using VB.NET, TV3D 6.5, Win 7
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
Dimple
Community Member
*
Posts: 632


« Reply #3 on: September 02, 2009, 08:16:54 PM »

 Sad

Nope, it didn't fix it. I tried it with (Land = Scene.CreateLandscape("Landscape")) and with Land = Scene.CreateLandscape("Water").  I have the same errors as before.  Here's some more code to look at:

Code:
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        Me.Show()
        Me.Focus()

        ' We have to create the TV object before anything else.
        TV = New TVEngine

        ' We put the debug file in the app directory
        TV.SetDebugFile(VB6.GetPath & "\debug.txt")

        ' We initialize TV in the picture box of the form.
        TV.Init3DWindowed(Me.Handle, True)

        ' We want to see the FPS.
        TV.DisplayFPS(True)

        ' We set the angle system to degree
        TV.SetAngleSystem(CONST_TV_ANGLE.TV_ANGLE_DEGREE)

        ' We create the input object.
        InputEngine = New TVInputEngine

        ' New : we create the graphic object so we can add some fog.
        GraphicFX = New TVGraphicEffect
        Light = New TVLightEngine
        ' We create the scene (the world).
        Scene = New TVScene

        ' We create the atmosphere class
        Atmos = New TVAtmosphere

        ' New : as said above, we need to create a new object which will
        ' hold all the textures needed for our land.
        TextureFactory = New TVTextureFactory

        ' We load the sky texture.
        TextureFactory.LoadTexture("..\..\..\..\Media\top.bmp", "SkyTop")
        TextureFactory.LoadTexture("..\..\..\..\Media\bottom.bmp", "SkyBottom")
        TextureFactory.LoadTexture("..\..\..\..\Media\left.bmp", "SkyLeft")
        TextureFactory.LoadTexture("..\..\..\..\Media\right.bmp", "SkyRight")
        TextureFactory.LoadTexture("..\..\..\..\Media\front.bmp", "SkyFront")
        TextureFactory.LoadTexture("..\..\..\..\Media\back.bmp", "SkyBack")

        ' We set the sky textures.
        Atmos.SkyBox_SetTexture(Globals.GetTex("SkyFront"), Globals.GetTex("SkyBack"), Globals.GetTex("SkyLeft"), Globals.GetTex("SkyRight"), Globals.GetTex("SkyTop"), Globals.GetTex("SkyBottom"))
        Atmos.SkyBox_Enable(True)

        ' New : as said above, we need to create a new object which will
        ' hold all the textures needed for our land.
        TextureFactory = New TVTextureFactory

        ' New : the land generation. This is so much fun because it's
        ' so simple! You load a texture as a height map, the engine
        ' does the rest. But before this, we create the land object.
        Land = New TVLandscape

        ' New : the land generation. This is so much fun because it's
        ' so simple! You load a texture as a height map, the engine
        ' does the rest. But before this, we create the land object.
        'Land = Scene.CreateLandscape("Landscape")

        ' Generate the height of the land from the grayscale of the image.
        'Land.GenerateHugeTerrain("..\..\..\..\Media\heightmap.jpg", TrueVision3D.CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, 8, 8, -700, -1024, True)
        Land.GenerateTerrain("..\..\..\..\Media\heightmap.jpg", CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, 8, 8, -700, -1024, True)

        ' Because we don't want to have mountains with height that get to
        ' the clouds, we adjust the height (Y) factor.
        'Land.SetFactorY(0.7)
        Land.SetHeight(0, 7, 0)

        ' Then, we load the land texture.
        TextureFactory.LoadTexture("..\..\..\..\Media\dirtandgrass.jpg", "LandTexture")

        ' We assign a texture to that land.
        Land.SetTexture(Globals.GetTex("LandTexture"))
        Land.SetTextureScale(3, 3)

        ' New : the sun. We have to place the sun in the world. Just like the
        ' sky box, the sun is attached to the camera position vector. You will
        ' never notice it until you start playing really badly with the
        ' properties of the sun. Let's start by loading a texture for it.
        TextureFactory.LoadTexture("..\..\..\..\Media\sun.jpg", "Sun")

        ' Then, initialize it by placing it via a vector.
        Atmos.Sun_SetTexture(Globals.GetTex("Sun"))
        Atmos.Sun_SetBillboardSize(0.1)
        Atmos.Sun_SetPosition(-1000, 570, 0)
        Atmos.Sun_Enable(True)

        ' New : To add extra visual effects, we add a lens flare effect. For
        ' this, we have to load some cirles that will be used to simulate
        ' the flare effect.
        TextureFactory.LoadTexture("..\..\..\..\Media\flare1.jpg", "Flare1")
        TextureFactory.LoadTexture("..\..\..\..\Media\flare2.jpg", "Flare2")
        TextureFactory.LoadTexture("..\..\..\..\Media\flare3.jpg", "Flare3")
        TextureFactory.LoadTexture("..\..\..\..\Media\flare4.jpg", "Flare4")

        ' Initialize the lens flares.
        Atmos.LensFlare_SetLensNumber(4)
        Atmos.LensFlare_Enable(True)
        Atmos.LensFlare_SetLensParams(0, Globals.GetTex("Flare1"), 2 * 5, 40, Globals.RGBA(1, 1, 1, 0.5), Globals.RGBA(1, 1, 1, 0.5))
        Atmos.LensFlare_SetLensParams(1, Globals.GetTex("Flare2"), 2 * 1, 18, Globals.RGBA(1, 1, 1, 0.5), Globals.RGBA(1, 1, 1, 0.5))
        Atmos.LensFlare_SetLensParams(2, Globals.GetTex("Flare3"), 2 * 1.8, 15, Globals.RGBA(1, 1, 1, 0.5), Globals.RGBA(0.7, 1, 1, 0.5))
        Atmos.LensFlare_SetLensParams(3, Globals.GetTex("Flare4"), 2 * 1, 6, Globals.RGBA(1, 0.1, 0, 0.5), Globals.RGBA(0.5, 1, 1, 0.5))

        Land = Scene.CreateLandscape("Water")

        'Land.SetAffineLevel(CONST_TV_LANDSCAPE_AFFINE.TV_AFFINE_LOW)
        ' New : also for fun, we add animated water. We start by loading the
        ' water teture...
        TextureFactory.LoadTexture("..\..\..\..\Media\water.bmp", "Water")

        ' Then, we set everything we can for this water.
        'Land.SetWaterTexture(TrueVision3DTVGlobals_definst.GetTex("Water"))
        'Land.SetWaterEffect(False, 0.5, True, DxVBLibA.CONST_D3DBLEND.D3DBLEND_SRCALPHA, DxVBLibA.CONST_D3DBLEND.D3DBLEND_INVSRCALPHA, False)
        'Land.SetWaterTextureScale(5)

        ' Then, we set everything we can for this water.
        Land.SetWaterTexture(Globals.GetTex("Water"))
        Land.SetWaterEffect(False, 0.5, True, CONST_TV_BLENDEX.TV_BLENDEX_SRCALPHA, CONST_TV_BLENDEX.TV_BLENDEX_INVSRCALPHA, False)
        Land.SetWaterTextureScale(5)

        ' We set the water height via a variable. We need this variable
        ' to be able to add an extra underwater fog effect later, at the
        ' rendering.
        sngWaterHeight = 100
        Land.SetWaterAltitude(sngWaterHeight)

        ' And we finish by enabling the water.
        Land.SetWaterEnable(True)

        ' New : for fun, we will also add some clouds, just over the water
        ' to give a creepy fog effect. Let's start by loading the clouds textures.
        TextureFactory.LoadTexture("..\..\..\..\Media\clouds.dds", "Clouds", CONST_TV_COLORKEY.TV_COLORKEY_BLACK)

        ' Then, set the land's clouds.
        Land.InitClouds(Globals.GetTex("Clouds"), CONST_TV_CLOUDMODE.TV_CLOUD_MOVE, 500, 1, 1, 2, 2, 1024)
        Land.SetCloudVelocity(1, 0.01, 0.01)

Logged

Using VB.NET, TV3D 6.5, Win 7
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
jviper
Community Member
*
Posts: 2131

Discipline in training


« Reply #4 on: September 02, 2009, 08:35:22 PM »

Does it work when you remove the "Land = New TVLandscape"?
Logged

JAbstract.....Don't just imagine, make it happen!
Dimple
Community Member
*
Posts: 632


« Reply #5 on: September 02, 2009, 08:38:42 PM »

 Nope, did a build and got the same eight errors.

Logged

Using VB.NET, TV3D 6.5, Win 7
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
Dimple
Community Member
*
Posts: 632


« Reply #6 on: September 11, 2009, 04:11:59 PM »

Well, I'm still stuck on this one and not happy with myself.  Since I've not been able to post the code in a post because it's too long. I'll post a link to download a text file of it in a zip folder.  Here it is  If you see what I'm missing - same 8 errors as before! Let me know please.

 
Logged

Using VB.NET, TV3D 6.5, Win 7
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
Ghost
Community Member
*
Posts: 49


WWW
« Reply #7 on: September 12, 2009, 03:30:04 PM »

Have a look at this:
http://tv3dsamples.blogspot.com/2008/04/tv-65-vb-net-tutorials.html

Tutorial 8 is working. I just tested it. So all you have to do is compare it to your code and you should find the error in no time Smiley
Logged

Dimple
Community Member
*
Posts: 632


« Reply #8 on: September 12, 2009, 09:39:14 PM »

 Smiley

Thank you Ghost. I had forgotten about that set of samples from TV3DSamples. I've been using a 6.2 and a 6.3 version while working on these tutorials. I will read through the code and see if that will help. Thanks again! I think you just got me unstuck.....

Logged

Using VB.NET, TV3D 6.5, Win 7
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
Dimple
Community Member
*
Posts: 632


« Reply #9 on: September 13, 2009, 02:19:27 AM »

 Huh


Okay some progress, but I seem to have a poor understanding of how to get the water plane to where it should be on the Landscape.  I'll post the code (Below) that I think should be telling it where to go, but isn't placing it on the landscape. As you can see by the above picture.

Code:
' New : the land generation. This is so much fun because it's
        ' so simple! You load a texture as a height map, the engine
        ' does the rest. But before this, we create the land object.
        Land = Scene.CreateLandscape("Landscape")

        Land.SetAffineLevel(CONST_TV_LANDSCAPE_AFFINE.TV_AFFINE_LOW)

        ' Generate the height of the land from the grayscale of the image.
        Land.GenerateTerrain("..\..\..\..\Media\heightmap.jpg", CONST_TV_LANDSCAPE_PRECISION.TV_PRECISION_LOW, 8, 8, -600, -1024, 0, True)

        ' Then, we load the land texture.
        TFactory.LoadTexture("..\..\..\..\Media\dirtandgrass.jpg", "LandTexture")

        ' We assign a texture to that land.
        Land.SetTexture(Globals.GetTex("LandTexture"))
        Land.SetTextureScale(3, 3)


        ' New : the sun. We have to place the sun in the world. Just like the
        ' sky box, the sun is attached to the camera position vector. You will
        ' never notice it until you start playing really badly with the
        ' properties of the sun. Let's start by loading a texture for it.
        TFactory.LoadTexture("..\..\..\..\Media\sun.jpg", "Sun")

        ' Then, initialize it by placing it via a vector.
        Atmos.Sun_SetTexture(Globals.GetTex("Sun"))
        Atmos.Sun_SetBillboardSize(0.1)
        Atmos.Sun_SetPosition(-1000, 570, 0)
        Atmos.Sun_Enable(True)

        ' New : To add extra visual effects, we add a lens flare effect. For
        ' this, we have to load some cirles that will be used to simulate
        ' the flare effect.
        TFactory.LoadTexture("..\..\..\..\Media\flare1.jpg", "Flare1")
        TFactory.LoadTexture("..\..\..\..\Media\flare2.jpg", "Flare2")
        TFactory.LoadTexture("..\..\..\..\Media\flare3.jpg", "Flare3")
        TFactory.LoadTexture("..\..\..\..\Media\flare4.jpg", "Flare4")

        ' Initialize the lens flares.
        Atmos.LensFlare_SetLensNumber(4)
        Atmos.LensFlare_Enable(True)
        Atmos.LensFlare_SetLensParams(0, Globals.GetTex("Flare1"), 2 * 5, 40, Globals.RGBA(1, 1, 1, 0.5), Globals.RGBA(1, 1, 1, 0.5))
        Atmos.LensFlare_SetLensParams(1, Globals.GetTex("Flare2"), 2 * 1, 18, Globals.RGBA(1, 1, 1, 0.5), Globals.RGBA(1, 1, 1, 0.5))
        Atmos.LensFlare_SetLensParams(2, Globals.GetTex("Flare3"), 2 * 1.8, 15, Globals.RGBA(1, 1, 1, 0.5), Globals.RGBA(0.7, 1, 1, 0.5))
        Atmos.LensFlare_SetLensParams(3, Globals.GetTex("Flare4"), 2 * 1, 6, Globals.RGBA(1, 0.1, 0, 0.5), Globals.RGBA(0.5, 1, 1, 0.5))


        ' New : also for fun, we add animated water. We start by loading the
        ' water teture...
        TFactory.LoadTexture("..\..\..\..\Media\water.bmp", "Water")

        WaterMesh = Scene.CreateMeshBuilder("Water")
        'TVParticle = New TVParticleSystem

        ' Then, we set everything we can for this water.
        'WaterMesh.SetWaterTexture(Globals.GetTex("Water"))
        WaterMesh.SetTexture(Globals.GetTex("Water"))
        'Land.SetWaterEffect(False, 0.5, True, TV8.CONST_D3DBLEND.D3DBLEND_SRCALPHA, DxVBLibA.CONST_D3DBLEND.D3DBLEND_INVSRCALPHA, False)
        '* Land.SetWaterEffect(False, 0.5, True, CONST_TV_BLENDEX.TV_BLENDEX_SRCALPHA, CONST_TV_BLENDEX.TV_BLENDEX_INVSRCALPHA, False)
        'Land.SetWaterTextureScale(5)
        WaterMesh.AddFloor(Globals.GetTex("Water") - 768, 0, (8 * 256) - 768, 8 * 256, sngWaterHeight, 1, 1, False)
        'Land.SetTexture(Globals.GetTex("Water"))
        'Land.SetEffect(False, 0.5, True, TVParticle.CONST_D3DBLEND.D3DBLEND_SRCALPHA, DxVBLibA.CONST_D3DBLEND.D3DBLEND_INVSRCALPHA, False)
        'Land.SetTextureScale(8, 8, 5)

        'trying out the reflectrs & refracts here.....
        'Creates the reflection/refraction render surfaces, which will be used for water
        'objects.
        ReflectRS = Scene.CreateRenderSurface(256, 256, True, 1)
        ReflectRS.SetBackgroundColor(Globals.RGBA(0, 0, 0.1906, 1))

        RefractRS = Scene.CreateRenderSurface(256, 256, True, 1)
        RefractRS.SetBackgroundColor(Globals.RGBA(0, 0, 0.1906, 1))

        ' We set the water height via a variable. We need this variable
        ' to be able to add an extra underwater fog effect later, at the
        ' rendering.
        'sngWaterHeight = 100
        sngWaterHeight = -1
        'Land.SetWaterAltitude(sngWaterHeight)
        WPlane.Dist = sngWaterHeight
        WPlane.Normal = Globals.Vector3(0, 1, 0)
        ' New : we create the graphic object so we can add some fog.
        GraphicFX = New TVGraphicEffect
        ' And we finish by enabling the water.
        'Scene.SetWaterEnable(True)
        GraphicFX.SetWaterReflection(WaterMesh, ReflectRS, RefractRS, 0, WPlane)
        ' New : for fun, we will also add some clouds, just over the water
        ' to give a creepy fog effect. Let's start by loading the clouds textures.
        TFactory.LoadTexture("..\..\..\..\Media\clouds.dds", "Clouds", MTV3D65.CONST_TV_COLORKEY.TV_COLORKEY_BLACK)

        ' Then, set the land's clouds.
        'MTV3D65.InitClouds(Globals.GetTex("Clouds"), MTV3D65.CONST_TV_LAND_CLOUDMODE.TV_CLOUD_MOVE, 500, 1, 1, 2, 2, 1024)
        'Land.SetTexture(Globals.GetTex("Clouds"), CONST_TV_CLOUDMODE.TV_CLOUD_MOVE, 500, 1, 1, 2, 2, 1024)
        'Land.SetCloudVelocity(1, 0.01, 0.01)

        ' We set the camera vectors (position and look at) and angles.
        'sngPositionX = 0
        'sngPositionY = 20
        'sngPositionZ = 0
        'snglookatX = 0
        'snglookatY = 20
        'snglookatZ = 50
        'sngAngleX = 0
        'sngAngleY = 0

        sngPositionX = 70
        sngPositionY = 38
        sngPositionZ = 40
        snglookatX = 70
        snglookatY = 20
        snglookatZ = 90
        sngAngleX = 0
        sngAngleY = 0


        ' We set the initial values of movement
        sngWalk = 0
        sngStrafe = 0

        'Set the viewing distance
        'Scene.SetViewFrustum(90, 4000)
        Scene.SetViewFrustum(60, 4000)
Logged

Using VB.NET, TV3D 6.5, Win 7
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
Toaster
Community Member
*
Posts: 378


WWW
« Reply #10 on: September 13, 2009, 03:16:00 AM »

Code:
WaterMesh.AddFloor(Globals.GetTex("Water") - 768, 0, (8 * 256) - 768, 8 * 256, sngWaterHeight, 1, 1, False)

That line looks horribly wrong. It shouldn't be too hard to figure out why.

-Toaster
Logged

Visit my site at: Unknown Abstraction
Dimple
Community Member
*
Posts: 632


« Reply #11 on: September 13, 2009, 10:59:35 AM »

 Sad

Uhh... Toaster?  What line? What the...  It's visible here in the topic summary!  I'll check it out. Sorry, this post may be not have been necessary.
« Last Edit: September 13, 2009, 11:03:13 AM by Dimple » Logged

Using VB.NET, TV3D 6.5, Win 7
~~~~~~~~~~~~~~~~~~~~~~~

"Know how to ask. There is nothing more difficult for some people, nor for others, easier."

- Baltasar Gracian
pekbo
Community Member
*
Posts: 1


« Reply #12 on: January 27, 2012, 09:53:20 PM »

i dont seem to have Land = Scene.CreateLandscape(..) in my truevision 6.2 but there is in truevision 6.5. I wanna use my truevision 6.2 however. how is it so? Sad
Logged
Mithrandir_
Moderator
Community Member
*****
Posts: 358


WWW
« Reply #13 on: January 28, 2012, 01:51:22 AM »

In 6.5 you use the Scene object to create instances of other objects (meshes, actors, landscapes, etc...).

In 6.2 I assume it is just Land = new TV_Landscape().
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks