BBC BASIC for Windows
« Renderer Interface October 8 ??? HA ! I found it »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:54pm



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: Renderer Interface October 8 ??? HA ! I found it  (Read 170 times)
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
question Renderer Interface October 8 ??? HA ! I found it
« Thread started on: Oct 9th, 2017, 11:48pm »

SOLUTION:
Quote:
Note that the number of objects (5th parameter) is 2, but all other arrays are 0-based

********************************V- look bellow the V.. 2 says there are 2 objects.. I have more
PROC_render(d%, &FF7F7F7F, 0, l%(), 2, m%(), t%(), b%(), n%(), f%(), s%(), y(), p(), r(), X(), Y(), Z(), e(), a(), PI/4, 5/4, 1, 1000,0) :REM experimental


I placed the code bellow all of this in case that's all you will need to figure this out. ....

You will have to download the files to try this out:


https://1drv.ms/f/s!AmYwmTjbmULXlwbfDh4TdArg3LXZ


The program you need to look at is :

RENDERER INTERFACE October 8.bbc

The problem is:

I cant seem to add the Blackdot image on its 3D layer. Perhaps I am doing something wrong?

All the other constructs were made. Of course the first idea was to make an odometer with 0-9 and so I could make a scrolling counter of any size.

Code:
      IF INKEY$(-256)="W" INSTALL @lib$+"D3DLIBA" ELSE INSTALL @lib$+"OGLLIB"
      PROCcreate3d
      e%=0:d%=0
      MODE 8
      DIM l%(0), b%(3), n%(3), f%(3), s%(3), m%(3), t%(3), y(3), p(3), r(3), X(3), Y(3), Z(3), e(2), a(2)
      ON CLOSE PROCcleanup:QUIT
      ON ERROR PROCcleanup:PRINT REPORT$:END
      IF INKEY$(-256)="W" d% = FN_initd3d(@hwnd%, 1, 0) ELSE d% = FN_initgl(@hwnd%, 1, 0)
      IF d% = 0 ERROR 100, "Can't initialise Direct3D"
      b%(0) = FN_load3d(d%, @dir$+"button.FVF", n%(0), f%(0), s%(0))
      IF b%(0) = 0 ERROR 100, "Can't load button.FVF"
      t%(0) = FN_loadtexture(d%, @dir$+"interface.jpg"):REM
      IF t%(0) = 0 ERROR 100, "Can't load texture"

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

      t%(1) = FN_loadtexture(d%,@dir$+"GreenPointer.jpg"):REM Triangle number pointer **
      IF t%(1) = 0 ERROR 100, "Can't load texture"

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

      t%(2) = FN_loadtexture(d%,@dir$+"Blackdot.jpg")
      IF t%(2) = 0 ERROR 100, "Can't load texture"

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

      t%(3) = FN_loadtexture(d%,@dir$+"Blackdot.jpg")
      IF t%(3) = 0 ERROR 100, "Can't load texture"

      REM b%(4) = FN_load3d(d%,@dir$+"button.FVF",n%(4), f%(4), s%(4)):REM 2
      REM  IF b%(4) = 0 ERROR 100, "Can't load button.FVF"

      REM t%(4) = FN_loadtexture(d%,@dir$+"2.jpg")
      REM IF t%(4) = 0 ERROR 100, "Can't load texture"


      e() = 0, 0, -6
      a() = 0, 0, 0
      REM l%()=1  :You aren't using any lighting, so don't need this.
      REPEAT
  
        y() =0:REM yaw (rotations around the Y axis)
        REM Z() depth
        REM Z(0) =  -5: Y(0)=-0.7 :X(0)=-0.9
        Z(0) = -4.6:Y(0)=-0.6:X(0)=-.8
        REM Given this is constant, you don't need to have it inside the loop.
        REM You could achieve the same end with one object by changing the eye position Z coordinate.
        REM Better to use the Z array values to move objects relative to *each other* rather than relative to the eye position?
  
        X(3)=0.3
        Y(3)=0
        Z(3)=-4
  
        X(1)=-0.4
        Y(1)=-0.25
        Z(1)=-4.7
  
        REM Now render the 3D scene. Note that the number of objects (5th parameter) is 2, but all other arrays are 0-based (i.e. X(0) is the X position of the first object)
        PROC_render(d%, &FF7F7F7F, 0, l%(), 2, m%(), t%(), b%(), n%(), f%(), s%(), y(), p(), r(), X(), Y(), Z(), e(), a(), PI/4, 5/4, 1, 1000,0) :REM experimental
        WAIT 1
  
      UNTIL INKEY(1)=0


      PROCcleanup
      END
      :
      DEF PROCcleanup
      t%(0) += 0:IF t%(1) PROC_release(t%(1))
      b%(0) += 0:IF b%(0) PROC_release(b%(0))
      d% += 0   :IF d%    PROC_release(d%)
      ENDPROC
      :
      DEF PROCcreate3d
      F% = OPENOUT"button.FVF"
      PROC4(6):REM 3 vertices
      PROC4(&140102):REM vertex size &18 and format &142 - change format to specify UV texture coordinates instead of colours,
      REM and allow the extra 4 bytes that requires (+8 for texture address, -4 for no colour)
      REM       LL x            LL y            LL z          u (x coord of texture) v (y coord of texture)
      PROC4(FN_f4(-0.5)):PROC4(FN_f4(-0.5)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(FN_f4(0.0))
      REM       LR x            LR y            LR z
      PROC4(FN_f4(0.5)):PROC4(FN_f4(-0.5)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0))
      REM     PEAK X     PEAK Y             PEAK Z
      PROC4(FN_f4(0.5)):PROC4(FN_f4(0.5)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0))

      PROC4(FN_f4(-0.5)):PROC4(FN_f4(-0.5)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(FN_f4(0.0))
      REM       LR x            LR y            LR z
      PROC4(FN_f4(-0.5)):PROC4(FN_f4(0.5)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(FN_f4(1.0))
      REM     PEAK X     PEAK Y             PEAK Z
      PROC4(FN_f4(0.5)):PROC4(FN_f4(0.5)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0))
      CLOSE #F%

      F% = OPENOUT"tinybutton.FVF"
      PROC4(6):REM 3 vertices
      PROC4(&140102):REM vertex size &18 and format &142 - change format to specify UV texture coordinates instead of colours,
      REM and allow the extra 4 bytes that requires (+8 for texture address, -4 for no colour)
      REM       LL x            LL y            LL z          u (x coord of texture) v (y coord of texture)
      PROC4(FN_f4(-0.05)):PROC4(FN_f4(-0.05)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(FN_f4(0.0))
      REM       LR x            LR y            LR z
      PROC4(FN_f4(0.05)):PROC4(FN_f4(-0.05)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0))
      REM     PEAK X     PEAK Y             PEAK Z
      PROC4(FN_f4(0.05)):PROC4(FN_f4(0.05)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0))

      PROC4(FN_f4(-0.05)):PROC4(FN_f4(-0.05)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(FN_f4(0.0))
      REM       LR x            LR y            LR z
      PROC4(FN_f4(-0.05)):PROC4(FN_f4(0.05)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(FN_f4(1.0))
      REM     PEAK X     PEAK Y             PEAK Z
      PROC4(FN_f4(0.05)):PROC4(FN_f4(0.05)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0))
      CLOSE #F%

      ENDPROC
      :
      DEF PROC4(A%):BPUT#F%,A%:BPUT#F%,A%>>8:BPUT#F%,A%>>16:BPUT#F%,A%>>24:ENDPROC
 


« Last Edit: Oct 9th, 2017, 11:53pm 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