michael
Senior Member
member is offline


Posts: 335
|
 |
driving in D3D explained-within code
« Thread started on: Mar 15th, 2016, 07:05am » |
|
This Utility will help you make B3D creations, but it has a 30 day trial ( I tried it) http://milkshape3d.com/
( I wouldn't bother using it until the following problems are solved) ************************************************ Preview of work not shown : (ok I stopped it from spinning ) 1) Making it display in two locations is a problem.. I think it has to do with the renders.. ( It shows a flickering Pyramid and a Pyramid that is constant in two locations)
I also have figured out how to place both items within the N S E W locations.. 2) But still don't know how to move overhead ************************************************
I thought it was Blender 3D that was for B3D but I am not sure now that I downloaded it. ( there is a converter for obj files but I don't know what to trust) I have experience on Blender but it has been years since I played with it. I am researching if it can make B3D files .
I talked to Richard about posting supplied files in forums for learning purposes. He said it would be ok. I plan to take this all the way to actual game piece distribution. This is the Pyramid example.. But as you all know it just spins around mindlessly on the screen. I duplicated the focus line I found to control the object. AND I CREATED drive TO DRIVE AWAY !! I found that: 1) it controls the rate of rotation 2) it also controls the location in the world (drive) variable LOOK!! 3) The settings can effect the way the 3D Image is stretched 4) One step closer.. soon I will duplicate the triangle and place pieces on the playing field, --- I think when an object reaches a certain point it cycles back even though it was going in one direction.. I think that may be related to your world render size.. HMMMMM ----Discovery.. I think attempting to render the same 3D image twice is not working properly.. (maybe due to the idea that there should only be one control for one object..)
I would appreciate help if you know better than me.. I just started the 3D stuff today.. I also have put statements to explain how some of the arrays are holding the 3D image and why a base object is required separate from the 3D pyramid. Code:
MODE 8
REM 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)
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)
INSTALL @lib$+"D3DLIB"
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$+"PYRAMID.B3D", n%(0), f%(0), s%(0))
IF b%(0) = 0 ERROR 100, "Can't load PYRAMID.B3D"
b%(1) = FN_load3d(d%, @dir$+"BASE.B3D", n%(1), f%(1), s%(1))
IF b%(1) = 0 ERROR 100, "Can't load BASE.B3D"
t%(1) = FN_loadtexture(d%, @dir$+"CLOCK.JPG")
IF t%(1) = 0 ERROR 100, "Can't load CLOCK.JPG"
e() = 0, 0, -6
REM e() = 0, 0, -6
a() = 0, 0, 0
approach=5
REPEAT
p() = TIME/100
r() = TIME/40
X() = SIN(TIME/200)
REM drive will move the object away from you at .001 steps in the world.. It can go slower. * the drive variable is increasing. * So to stop it you would just not increase its value. (having issues with it returning?)
drive= drive+.001
approach=approach+.002
PROC_render(d%, &FF7F7F7F, 0, l%(), 2, m%(), t%(), b%(), n%(), f%(), s%(), y(), p(), r(), X(), Y(), Z(), e(), a(), approach, 5/4, 1, 1000)
REM PROC_render(d%, &FF7F7F7F, 0, l%(), 2, m%(), t%(), b%(), n%(), f%(), s%(), y(), p(), r(), X(), Y(), Z(), e(), a(), drive, approach, 1, 1000) REM hmmm why is this doing what it is?
REM HERE IS YOUR OBJECT PARTS *******************t*****b*****n*****f*****s
REM t%(1) is your clock texture
REM b%(0) holds the Pyramid.B3D construct n%(0),f%(0),s(0) --- Just the 3D Pyramid
REM b%(1) holds the Base.B3D construct n%(1),f%(1),s%(1) -- This is needed because if the texture was loaded on the pyramid it would cover all sides
REM I will improve this program as I disect the render command
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
I am gaining something.. it is not working like I want. .. This is tough stuff Code: MODE 8
REM 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)
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)
INSTALL @lib$+"D3DLIB"
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$+"PYRAMID.B3D", n%(0), f%(0), s%(0))
IF b%(0) = 0 ERROR 100, "Can't load PYRAMID.B3D"
b%(1) = FN_load3d(d%, @dir$+"BASE.B3D", n%(1), f%(1), s%(1))
IF b%(1) = 0 ERROR 100, "Can't load BASE.B3D"
t%(1) = FN_loadtexture(d%, @dir$+"CLOCK.JPG")
IF t%(1) = 0 ERROR 100, "Can't load CLOCK.JPG"
e() = 0, 0, -6
REM e() = 0, 0, -6
a() = 0, 0, 0
approach=-4
dir$="away"
REPEAT
IF dir$="away" THEN approach=approach +.001
IF approach<=-3 THEN dir$="towards"
IF dir$="towards" THEN approach=approach -.001
IF approach>=3 THEN dir$="away"
p() = +2
r() = 12.5
X() = 0
REM drive will move the object away from you at .001 steps in the world.. It can go slower. * the drive variable is increasing. * So to stop it you would just not increase its value. (having issues with it returning?)
drive= drive+.001
PROC_render(d%, &FF7F7F7F, 0, l%(), 2, m%(), t%(), b%(), n%(), f%(), s%(), y(), p(), r(), X(), Y(), Z(), e(), a(), approach, 5/4, 1, 1000)
REM PROC_render(d%, &FF7F7F7F, 0, l%(), 2, m%(), t%(), b%(), n%(), f%(), s%(), y(), p(), r(), X(), Y(), Z(), e(), a(), drive, approach, 1, 1000) REM hmmm why is this doing what it is?
REM HERE IS YOUR OBJECT PARTS *******************t*****b*****n*****f*****s
REM t%(1) is your clock texture
REM b%(0) holds the Pyramid.B3D construct n%(0),f%(0),s(0) --- Just the 3D Pyramid
REM b%(1) holds the Base.B3D construct n%(1),f%(1),s%(1) -- This is needed because if the texture was loaded on the pyramid it would cover all sides
REM I will improve this program as I disect the render command
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
|