BBC BASIC for Windows
« 3D LEFT/ RIGHT Mouse controlled image Breakthrough »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:45pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: 3D LEFT/ RIGHT Mouse controlled image Breakthrough  (Read 263 times)
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx 3D LEFT/ RIGHT Mouse controlled image Breakthrough
« Thread started on: Mar 15th, 2016, 11:17am »

All is progressing nicely.. A controlled 3D image

You need to be in the EXAMPLES\GRAPHICS folder in BBC Basic Directory to use this program since the B3D files are there and there is also the Library for the graphics.

Hold left or right mouse down to control the distance.
I will set up keyboard controls later since I know how to move it left and right too.
Code:
      MODE 8
      REM DIM l%(0), b%(1), n%(1), f%(1), s%(1), m%(1), t%(1), y(1), p(1), r(1), X(1), Y(1), Z(1), e(2), a(2)
      DIM l%(0), b%(1), n%(1), f%(1), s%(1), m%(1), t%(1), y(1), p(1), r(1), X(1), Y(1), Z(1), e(2), a(2)
      INSTALL @lib$+"D3DLIB"

      ON CLOSE PROCcleanup:QUIT
      ON ERROR PROCcleanup:PRINT REPORT$:END

      d% = FN_initd3d(@hwnd%, 1, 0)
      IF d% = 0 ERROR 100, "Can't initialise Direct3D"

      b%(0) = FN_load3d(d%, @dir$+"PYRAMID.B3D", n%(0), f%(0), s%(0))
      IF b%(0) = 0 ERROR 100, "Can't load PYRAMID.B3D"

      b%(1) = FN_load3d(d%, @dir$+"BASE.B3D", n%(1), f%(1), s%(1))
      IF b%(1) = 0 ERROR 100, "Can't load BASE.B3D"

      t%(1) = FN_loadtexture(d%, @dir$+"CLOCK.JPG")
      IF t%(1) = 0 ERROR 100, "Can't load CLOCK.JPG"
      e() = 0, 0, -6
      REM e() = 0, 0, -6
      a() = 0, 0, 0
      approach=-4
      dir$="away"
      REPEAT
        MOUSE xxxx,yyy,bbb
        IF bbb=4 THEN approach=approach -.005
        IF bbb=1 THEN approach=approach +.005
        p() = +2
        r() = 12.5
        X() = 0
        REM drive will move the object away from you at .001 steps in the world.. It can go slower.  * the drive variable is increasing. *  So to stop it you would just not increase its value. (having issues with it returning?)
        drive= drive+.001
  
        PROC_render(d%, &FF7F7F7F, 0, l%(), 2, m%(), t%(), b%(), n%(), f%(), s%(), y(), p(), r(), X(), Y(), Z(), e(), a(), approach, 5/4, 1, 1000)
        REM PROC_render(d%, &FF7F7F7F, 0, l%(), 2, m%(), t%(), b%(), n%(), f%(), s%(), y(), p(), r(), X(), Y(), Z(), e(), a(), drive, approach, 1, 1000)   REM hmmm why is this doing what it is?
        REM HERE IS YOUR OBJECT PARTS *******************t*****b*****n*****f*****s
        REM t%(1) is your clock texture
        REM b%(0) holds the Pyramid.B3D construct  n%(0),f%(0),s(0) --- Just the 3D Pyramid
        REM b%(1) holds the Base.B3D construct n%(1),f%(1),s%(1)  -- This is needed because if the texture was loaded on the pyramid it would cover all sides
        REM I will improve this program as I disect the render command
      UNTIL INKEY(1)=0
      END

      DEF PROCcleanup
      t%(1) += 0:IF t%(1) PROC_release(t%(1))
      b%(0) += 0:IF b%(0) PROC_release(b%(0))
      b%(1) += 0:IF b%(1) PROC_release(b%(1))
      d% += 0   :IF d%    PROC_release(d%)
      ENDPROC
 
« Last Edit: Mar 15th, 2016, 10:12pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls