BBC BASIC for Windows
« D3D lets figure it out ?(updated) »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:07pm



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: D3D lets figure it out ?(updated)  (Read 572 times)
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy D3D lets figure it out ?(updated)
« Thread started on: Dec 28th, 2016, 9:39pm »

Even if the original D3D might be supposedly obsolete, it still works in windows 10.. So whats the issue? I have no idea. But if it really is going to be wiped off windows, then when? Where is the article?

UPDATE: I looked.. It hasn't been removed and it looks like it wont be. What is said is that they recommend using D3D11 for windows 8 and 10.. The original D3D which is part of the Direct3D API list is still there, just its not the focus of the forums in MSDN.

UPDATE: I figured out how the verticies work !!!! WOOO HOOO!!! Isn't this exciting ? New Years 3D!!!
By the way the demo is at the base of this post..

This snippet helps you understand making a triangle in the 3D world and saving it to a file.
Code:
      DEF PROCcreate3d
      F% = OPENOUT"TRIANGLE.B3D"
      PROC4(3):REM 3 vertices
      PROC4(&100042):REM vertex size &10 and format &42
      REM       LL x            LL y            LL z
      PROC4(FN_f4(-1.0)):PROC4(FN_f4(-1.0)):PROC4(FN_f4(1.0)):PROC4(&FF0000FF)
      REM       LR x            LR y            LR z
      PROC4(FN_f4(1.0)):PROC4(FN_f4(-1.0)):PROC4(FN_f4(1.0)):PROC4(&FF00FF00)
      REM     PEAK X     PEAK Y             PEAK Z
      PROC4(FN_f4(0.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(&FFFF0000)
      CLOSE #F%
      ENDPROC
      DEF PROC4(A%):BPUT#F%,A%:BPUT#F%,A%>>8:BPUT#F%,A%>>16:BPUT#F%,A%>>24:ENDPROC
 


I am not stopping until I get the mechanics of this worked out!! This is all I will do until it is solved !!

So far, I have gotten this much to work.
OPTION A
GOALS:
create a program that allows you to do text edit of the verticies, update the 3D file and update the screen with the 3D image.

There is no point in reinventing the 3D world... Lets work together to solve the barriers that make D3D complex.

A construct should be able to be understood for what space it occupies and the memory area that it uses.


If you look carefully, there is lots of REM statements explaining how I figured out how this works.

So it creates a triangle... (snippet from lesson)
I spliced that into the pyramid code and it just works.
I then studied the way the image is manipulated and added a texture ( doesn't give the image I made).

Perhaps because of lack of light

The yaw, roll, pitch, and coordinate system has been figured out..(REM STATEMENTS)
So now a person has COMPLETE control of the triangle..

If I can completely understand how that triangle is created with the information, then I can focus on making a utility for everyone to make objects easily

Help would be appreciated. Thankyou
I provide this solution for now. I will need help understanding the way the 3 verticies are made.. (in detail) I have tested this, and the controls work well (when applied to variables. right now I put them all at 0).

There is always option B.. relearn the wheel of 3D?
VIDEO?
https://youtu.be/KdyvizaygyY

I am hoping we can find a solution to option A

Code:
      INSTALL @lib$+"D3DLIB"
      PROCcreate3d
      MODE 8
      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)
      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$+"TRIANGLE.B3D", n%(0), f%(0), s%(0))
      IF b%(0) = 0 ERROR 100, "Can't load TRIANGLE.B3D"
      REM t%(0) = FN_loadtexture(d%, @dir$+"BLUE.BMP")
     REM  IF t%(0) = 0 ERROR 100, "Can't load face.JPG"
      e() = 0, 0, -6
      a() = 0, 0, 0
      REPEAT
        y() = 0:REM yaw (rotations around the Y axis)
        REM pitch
        p() =  0:REM TIME/100 (pitch angles rotations around the X axis)
        REM roll
        r() =  0:REM TIME/40 (roll angles (rotations around the Z axis)
        REM X (right left)
        X() =  0:REM SIN(TIME/200)
        REM Y() up and down
        Y() = 0
        REM Z() depth
        Z() =  10 :REM
        REM 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)
        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) :REM experimental
        REM          1     2       3   4    5   6     7     8     9     10    11   yaw pitch roll X    Y    Z eye0123  18   19   20   ^mcd  ^( cam to farplane dist)
        REM 1 Val returned from FN_init3D
        REM 2 back color   3 #of lights   4 light pointers
        REM mcd - minimum near cam distance
  
      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
      DEF PROCcreate3d
      F% = OPENOUT"TRIANGLE.B3D"
      PROC4(3):REM 3 vertices
      PROC4(&100042):REM vertex size &10 and format &42
      PROC4(FN_f4(-1.0)):PROC4(FN_f4(-1.0)):PROC4(FN_f4(1.0)):PROC4(&FF0000FF)
      PROC4(FN_f4(1.0)):PROC4(FN_f4(-1.0)):PROC4(FN_f4(1.0)):PROC4(&FF00FF00)
      PROC4(FN_f4(0.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(0.0)):PROC4(&FFFF0000)
      CLOSE #F%
      ENDPROC
      DEF PROC4(A%):BPUT#F%,A%:BPUT#F%,A%>>8:BPUT#F%,A%>>16:BPUT#F%,A%>>24:ENDPROC
 
;D
« Last Edit: Dec 30th, 2016, 11:05pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
Zaphod
Guest
cheesy Re: D3D lets figure it out ?(updated)
« Reply #1 on: Dec 30th, 2016, 4:38pm »


There are some interesting discussions on this forum about Directx8 being obsoleted and whether libraries should be updated to Directx9 at least. Perhaps you should do a search or two on the archives. You will find that the topic cause several people to get a little disillusioned.

Z
User IP Logged

DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
cheesy Re: D3D lets figure it out ?(updated)
« Reply #2 on: Dec 30th, 2016, 5:18pm »

For what it's worth, I've done a bit of work on D3D8, and the library certainly forms a very nice starting point for more sophisticated playing.

D3D9 is pretty similar, and Richard made an adapted library and a bunch of headers etc which make it easier to work out the functions and use them.

There was a lot of talk about moving towards D3D11, but it's rather different to use. Again Richard did quite a bit of work towards making this usable. My personal investment in 8/9 makes me rather reluctant to go down that route, mainly because I am lazy, but partly because it is quite complex (as well as powerful).

I'll dig out some bits and post them - at one stage (when I was working on the proto-flight sim discussed in these pages about 18 months ago) I got to the stage of being able to handle vertices with normals, textures, partial transparency, and mixing directional and ambient lighting, as well as rendering multiple buffers in a single scene., which might be useful to people.

One issue may be where files are/can be posted. Both the Wiggio and Yahoo repositories don't appear to be working at present.

Best wishes,

D
User IP Logged

Zaphod
Guest
cheesy Re: D3D lets figure it out ?(updated)
« Reply #3 on: Dec 30th, 2016, 6:03pm »

Quote:
One issue may be where files are/can be posted. Both the Wiggio and Yahoo repositories don't appear to be working at present.

I note that the old, old, Yahoo group https://groups.yahoo.com/neo/groups/bbcbasic/info is still there. You can't post messages as the admin requires approval and has long gone AWOL, but it says that joining does not require approval. The file section is open and has stuff from 10 years ago! It can only take 100 Meg of files but is there and free, so that might work.

Z
User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Re: D3D lets figure it out ?(updated)
« Reply #4 on: Dec 30th, 2016, 6:09pm »

Why would they abandon it? In a current Windows 10 install, which is all I have (no older windows involved) , this works just fine..
And Richard mentioned to me that there was no plans by Microsoft to move past windows 10 and that it only would be improved on the existing platform.

Of course, that doesn't mean that tech might affect the existence of windows. ( I am just being realistic)

I need to know everything.
But I need all the steps explained and once I know I can make a image generator that updates the screen. I think I also figured out the 2D interface that a mouse controlled image would interact with in the 3D world

User IP Logged

I like making program generators and like reinventing the wheel
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Re: D3D lets figure it out ?(updated)
« Reply #5 on: Dec 30th, 2016, 6:14pm »

Why not do this here? Lets do it!! Zaphod and DDRM and me and maybe others.. Lets just do it like I have above and expand on it in stages..

Imagine if we did that here. It would make this forum unique.

We can do it!!
« Last Edit: Dec 30th, 2016, 6:16pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
cheesy Re: D3D lets figure it out ?(updated)
« Reply #6 on: Dec 30th, 2016, 7:21pm »

Here is a REMed copy of the verticies in Direct X 11 . It seems that it is fairly easy to manipulate. Although, the overall code is considerably more complex. But only if you look at the entire program, as much of it is world setup.

I really think we need to focus hard on D3D 11 and get all the parts figured out, because its time to do so.
UPDATE:

( ok, after experimenting, this looks like this is just the construct of the triangle. It doesn't affect its location.. )
Code:
      DIM vertices{(2)} = SimpleVertex{}
      vertices{(0)}.x% = 0           :REM ? what? (is this a mistake?)
      vertices{(0)}.y% = FN_f4(0.5)  :REM peak   up down
      vertices{(0)}.z% = FN_f4(0.5)  :REM z axis (close)

      vertices{(1)}.x% = FN_f4(0.5)  :REM  LR corner x
      vertices{(1)}.y% = FN_f4(-0.5) :REM  LR corner y (up/down)
      vertices{(1)}.z% = FN_f4(0.5)  :REM  LR depth z

      vertices{(2)}.x% = FN_f4(-0.5) :REM LL corner x
      vertices{(2)}.y% = FN_f4(-0.5) :REM LL corner y (up/down)
      vertices{(2)}.z% = FN_f4(0.5)  :REM LL corner z  depth

 

If you look carefully you will see SimpleVertex{}
being allocated bellow into another array?

And the verticies array is also being factored in this ..vertices{()}
Code:
     DIM bd{} = D3D11_BUFFER_DESC{}
      bd.Usage% = D3D11_USAGE_DEFAULT
      bd.ByteWidth% = DIM(SimpleVertex{}) * (DIM(vertices{()},1)+1)
      bd.BindFlags% = D3D11_BIND_VERTEX_BUFFER
      bd.CPUAccessFlags% = 0

      DIM InitData{} = D3D11_SUBRESOURCE_DATA{}
      InitData.pSysMem% = vertices{(0)}
      SYS ID3D11Device.CreateBuffer%, pd3dDevice%, bd{}, InitData{}, ^pVertexBuffer% TO hr%
      IF hr% <> 0 OR pVertexBuffer% = 0 ERROR 100, "ID3D11Device::CreateBuffer failed: "+STR$~hr%

 
« Last Edit: Dec 30th, 2016, 9:51pm 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