michael
Full Member
member is offline


Posts: 157
|
 |
Real time 3D image edit concept
« Thread started on: Sep 18th, 2017, 5:03pm » |
|
Save this program before executing.
This shows the idea behind real time editing a set of rendered triangles in 3D.
The actual 3D image is changed during every cycle and updated on the renderer.
Later, more triangles will be created with controls for each one in a program that runs along side the renderer. So a person can make simple 3D images easily.
The renderer will look for commands in a file to appear to sync the new image load and to wait so the image doesn't cycle needlessly.
(by the way, it works on BBCSDL also. I am going to test it on Mac and on Raspberry Pi 3 as soon as I get the editor set up.. Which should be tonight (Sept 18, 2017 before midnight in Alberta Canada)
Code: peak=0 IF INKEY$(-256)="W" INSTALL @lib$+"D3DLIBA" ELSE INSTALL @lib$+"OGLLIB" 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 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" e() = 0, 0, -6 a() = 0, 0, 0 l%()=1 REPEAT PROCcreate3d b%(0) = FN_load3d(d%, @dir$+"TRIANGLE.FVF", n%(0), f%(0), s%(0)) IF b%(0) = 0 ERROR 100, "Can't load TRIANGLE.FVF" REM t%(1) = FN_loadtexture(d%, @dir$+"purple.JPG") REM IF t%(1) = 0 ERROR 100, "Can't load face.JPG" y() +=.01: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, 0) :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 t%() - holds texture REM mcd - minimum near cam distance WAIT 1 UNTIL FALSE 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.FVF" peak=peak+0.001 PROC4(6):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(&FF0000FF):REM PROC4(&FF00FF00) REM PEAK X PEAK Y PEAK Z PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(peak)):PROC4(&FF0000FF):REM PROC4(&FFFF0000) PROC4(FN_f4(-1.0)):PROC4(FN_f4(-1.0)):PROC4(FN_f4(1.0)):PROC4(&FF0000FF):REM PROC4(&FF0000FF) REM LR x LR y LR z PROC4(FN_f4(-1)):PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0)):PROC4(&FF0000FF):REM PROC4(&FF00FF00) REM PEAK X PEAK Y PEAK Z PROC4(FN_f4(1.0)):PROC4(FN_f4(1.0)):PROC4(FN_f4(-peak)):PROC4(&FF0000FF):REM PROC4(&FFFF0000) CLOSE #F% ENDPROC DEF PROC4(A%):BPUT#F%,A%:BPUT#F%,A%>>8:BPUT#F%,A%>>16:BPUT#F%,A%>>24:ENDPROC
|
| « Last Edit: Sep 18th, 2017, 8:34pm by michael » |
Logged
|
I like reinventing the wheel, but for now I will work on tools for D3D
|
|
|