BBC BASIC for Windows
« 3D editor tryout (12 triangles) »

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: 3D editor tryout (12 triangles)  (Read 201 times)
michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx 3D editor tryout (12 triangles)
« Thread started on: Sep 19th, 2017, 02:31am »

This version requires windows and BBC4W, as I created an executable and the renderer can be run in BBC4W.

Instructions:
* Copy all the files to a working writable directory
* Open BBC4W
OPEN the file called "RENDER.BBC"

While the program is waiting in your editor, execute the program called 3DAUTOCAD proj.exe and move it to the left side of the screen.

Now go back to BBC4W and execute RENDER program

Move the window to a nice spot to the right of the renderer

Use your mouse left button to scratch the renderer to make it update the active triangles (there are 12 stacked)

You then can move back and forth between your editor and the renderer to see the results of any actions you make on the editor. Be sure to hold the left mouse button and scratch the editor to be sure you are seeing the latest edit.

I beat the clock, but it needs much improvement. (like different textures and automatic updates for both screens instead of the mouse presence)

I did it like this because the file cant be read and written to at the same time. ( I will work that out later)

Also, the top of the triangle controls the LR and the LR controls the top... (oops!! Ill fix that later)


Here is the link to the files and if you have troubles with the executable, just make your own with the program provided with BBC Basic for windows or force it to run on your computer.

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

**********************************************
NOTE: all fixes will be listed bellow here and will be active in the link files once you see them

Fixed memory leak :
These 3 pieces of code are added to the render cycle
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))

« Last Edit: Sep 19th, 2017, 12:08pm by michael » User IP Logged

I like making program generators and like reinventing the wheel
DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: 3D editor tryout (12 triangles)
« Reply #1 on: Sep 19th, 2017, 09:11am »

Hi Michael,

I can't make it work very cleanly, but I am using Windows 7 - is there a particular reason you require Windows 10? The problem seems to be the renderer opening the file, presumably because the editor is still writing it.

If you combined the editing and rendering programs you could hold the vertex buffer in memory, which would (a) probably be much faster, and (b) allow you to access it from both parts of the program.

At the moment it looks like the renderer simply loads a new copy of the file with each update, without releasing the previous one. That's probably not too big a problem with 12 triangles, but represents a significant memory leak, which would be a major problem with a bigger model.

Are you updating the file with every click of the positioning boxes? Could you add a "macro-move" function - perhaps by dragging a triangle around a virtual window, and then working out the coordinates at the end? And/or allow a number of clicks, then a button saying "make it so" (choose Star Trek version of your choice!) to tell the editor to actually update the file? Could you make a right-click of the boxes move it 10 times as far?

Can you group triangles? So you can make a sub-assembly and then move the whole thing?

At the moment your code is hard-programmed for 12 triangles, with separate routines to handle each. How about using a 2D array, allowing you to identify the triangle by the first coordinate and the specific parameters by the second one? Then if you wanted more triangles you'd simply change the size of the array - or you could DIM the array to allow a maximum number, and then add them dynamically. That might also make the rendering less confusing, since you wouldn't have 11 stacked triangles hiding what is going on! Then you could also have a single routine to alter the relevant triangle, and just pass it tn%.

If you encoded your corners as 1,2, and 4, then 7 would mean all 3 - then you could make your update routines (PrOCone etc) a bit more compact as you could use "IF sel% AND 1", for example, which would update the relevant corner either when just that corner or the whole triangle is selected.

One advantage of separate arrays for each triangle is that you could use matrix arithmetic to move/rotate etc individual triangles. That's why I've used separate arrays for vertices, normals and textures in my program. However, combining them will make your program much more compact, and easy to extend.

Hope that's helpful!

D

User IP Logged

michael
Senior Member
ImageImageImageImage


member is offline

Avatar




PM


Posts: 335
xx Re: 3D editor tryout (12 triangles)
« Reply #2 on: Sep 19th, 2017, 12:18pm »

Yeah, I will eventually work out the kinks and I will add rotational controls.

I did discover a way to simulate communication between programs.

When the program windows are along side each other, coordinates outside the window can be sensed with the mouse. So if the modules are beside each other, I technically could make buttons in the other program and use the mouse to sense the activity in that section.

I did merge both programs together, but I like a nice display that doesn't flash, so that's why there are two separate programs. (that and behold!! 2 separate threads !)

I am experimenting with ways to send data back and forth without using files.

Also Ill work out a way to drag triangles from a staggered stack at the side and add slight color diffrences so they are easier to see
« Last Edit: Sep 19th, 2017, 12:22pm 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