I realise that it might be a lot of code to produce a shiny blob, but it was just to demonstrate it working. The code for the game I am writing is 15000ish lines long and I didn't want to start the porting with that. So I used tutorial 7 as it had shaders.
Unfortunately the blob was designed on my own modelling program, I can supply the data and it may work, but I don't think a standard D3D file loader would work. Having said that if you load the file directly into the vertices structure I see no reason why it wouldn't work.
@hwnd%
-
Ric
- Posts: 278
- Joined: Tue 17 Apr 2018, 21:03
Re: @hwnd%
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
Richard Russell
- Posts: 610
- Joined: Tue 18 Jun 2024, 09:32
Re: @hwnd%
I'd like to see it. I can handle various different 3D formats such as .obj (probably the most common of them all) or .fvf (Microsoft's Flexible Vertex Format) and in principle anything else that can be converted into one of those. If it's a triangular mesh I can use it directly, if it's a polygonal mesh using something different (e.g. rectangles) I can easily break it down into triangles. If it relies on a bump map that could be more tricky, but I'm guessing that as a shiny object to show off specular reflections it probably doesn't.
-
Ric
- Posts: 278
- Joined: Tue 17 Apr 2018, 21:03
Re: @hwnd%
You already have the file its called "D3D Lump RCE.bbc"
The format is
4 byte interger - Number of nodes(vertices) in the file
Then repeated
8 byte float - position X
8 byte float - position Y
8 byte float - position Z
8 byte float - normal X
8 byte float - normal Y
8 byte float - normal Z
8 byte float - texture U
8 byte float - texture V
8 byte float - alpha channel value, but this needs to be ignored for this model as it is a random number I used for testing when i first created the code to build the models.
It contains a simple triangle list.
Let me know how it goes.
The format is
4 byte interger - Number of nodes(vertices) in the file
Then repeated
8 byte float - position X
8 byte float - position Y
8 byte float - position Z
8 byte float - normal X
8 byte float - normal Y
8 byte float - normal Z
8 byte float - texture U
8 byte float - texture V
8 byte float - alpha channel value, but this needs to be ignored for this model as it is a random number I used for testing when i first created the code to build the models.
It contains a simple triangle list.
Let me know how it goes.
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
Richard Russell
- Posts: 610
- Joined: Tue 18 Jun 2024, 09:32
Re: @hwnd%
That's very similar to a standard FVF (Flexible Vertex Format) file, except that you're using 8-byte floats ('double') rather than 4-byte floats ('float'). If it's a custom format you devised, you might want to consider switching to FVF as it would be a simple change and make it compatible with both BB4W and BBCSDL libraries. The FVF format is documented in the BBC BASIC manual here.Ric wrote: ↑Mon 09 Mar 2026, 16:34 The format is
4 byte interger - Number of nodes(vertices) in the file
Then repeated
8 byte float - position X
8 byte float - position Y
8 byte float - position Z
8 byte float - normal X
8 byte float - normal Y
8 byte float - normal Z
8 byte float - texture U
8 byte float - texture V
8 byte float - alpha channel value, but this needs to be ignored for this model as it is a random number I used for testing when i first created the code to build the models.
As you may know, if you are using a 64-bit or ARM version of BBC BASIC for SDL 2.0 it has built-in support (*FLOAT 32) for writing and reading 4-byte floats to a file so there is no penalty in respect of conversion. That's not the case in BB4W or 32-bit x86 editions of BBCSDL however, and you would need to use conversion functions like FN_4f and FN_f4 (although they're surprisingly fast, all things considered).
-
Ric
- Posts: 278
- Joined: Tue 17 Apr 2018, 21:03
Re: @hwnd%
The code to create the models was written long before I thought about migrating to BBCSDL64. The vertices are converted to float4 at the point of loading and then all maths and matrix calculations are done in assembly. The code for the tutorial 7 I think uses FNf4.
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
Richard Russell
- Posts: 610
- Joined: Tue 18 Jun 2024, 09:32
-
Ric
- Posts: 278
- Joined: Tue 17 Apr 2018, 21:03
Re: @hwnd%
The file is loaded from line 8740(listed in 10s). When I run the program it returns a value of 5220 in NumOfVertices%, it is the first bit of data read from the file as far as I know.
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
Richard Russell
- Posts: 610
- Joined: Tue 18 Jun 2024, 09:32
Re: @hwnd%
It's not a 4-byte integer as you documented, it's an 8-byte value.
Here is your 'lump' animated in BBCSDL with a 72 line program written in about 5 minutes (using the supplied webgllib library)! You can also run it in your own browser by clicking here.
I do appreciate that you're using all that amount of Direct3D 11 code because your ultimate application requires features that the supplied libraries don't provide, but I would be interested to know just what those features are.
Can I use your lump and texture in future programs I might write and distribute? It's a beautiful object.
https://www.youtube.com/watch?v=g0WHTpQFAuA
-
Ric
- Posts: 278
- Joined: Tue 17 Apr 2018, 21:03
Re: @hwnd%
Yes no problem.
A lot of the features I use are render to texture based.
The obvious one is shadows.
But also vertex manipulation within the buffers.
A lot of the features I use are render to texture based.
The obvious one is shadows.
But also vertex manipulation within the buffers.
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
Richard Russell
- Posts: 610
- Joined: Tue 18 Jun 2024, 09:32
Re: @hwnd%
The BBC BASIC libraries can do real-time vertex manipulation, for example in the morphing example (below or in your browser here) and render-to-texture can use the technique in the supplied example conway.bbc, but yes shadows are not supported. I've considered it, and know roughly how to do it, but never actually attempted it.
https://www.youtube.com/watch?v=B97fedW9h2I