Pres3D source

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Pres3D source

Post by Michael Vogel »

Hi,
thought do have a look into the source to play around a little bit, but the effects.pbi seems to be absent, where can I get it?

Thanks,
Michael
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: Pres3D source

Post by Vera »

effects.pbi :

Code: Select all

#SpeedFactor  = 3 ; usually 1 to 5. Default = 3.

; -------------------------------------------------------------------------------------------
; INITS
; -------------------------------------------------------------------------------------------

; initialize the ingoing effect for the InObjects(CurrObject.l)
Procedure.l EffectInitIn(*Effect.structEffectParameters, ScreenWidth.l, ScreenHeight.l, CurrObject.l, GroupID.l, GroupMax.l)
  ; GroupID: which number of a group with GroupMax members am I?
  ; In case of no group (images?) set 1 and 1.
  With InObjects(CurrObject.l)
    
  *Effect\Direction = UCase(*Effect\Direction)
  *Effect\Rotation  = UCase(*Effect\Rotation)
    
  Select LCase(*Effect\Type)
      
    Case "standard" ; standard fade in effect
      \ActualTransparency = 0
      \Transform = #True
      ; movement
      If FindString(*Effect\Direction, "L", 1) > 0: \ActualPosX = \PosX - ScreenWidth.l : EndIf
      If FindString(*Effect\Direction, "R", 1) > 0: \ActualPosX = \PosX + ScreenWidth.l : EndIf
      If FindString(*Effect\Direction, "T", 1) > 0: \ActualPosY = \PosY - ScreenHeight.l : EndIf
      If FindString(*Effect\Direction, "B", 1) > 0: \ActualPosY = \PosY + ScreenHeight.l : EndIf
      If FindString(*Effect\Direction, "F", 1) > 0: \ActualPosZ = #InitialZ * 4: EndIf
      If FindString(*Effect\Direction, "V", 1) > 0: \ActualPosZ = 0: EndIf
      \Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
      \Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
      \Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
      ; rotation
      If FindString(*Effect\Rotation, "X", 1) > 0: \ActualAngleX = 8: EndIf
      If FindString(*Effect\Rotation, "Y", 1) > 0: \ActualAngleY = 8: EndIf
      If FindString(*Effect\Rotation, "Z", 1) > 0: \ActualAngleZ = 8: EndIf
      If FindString(*Effect\Rotation, "L", 1) > 0
        ; rotate left (counterclockwise)
        \ActualAngleX = - \ActualAngleX
        \ActualAngleY = - \ActualAngleY
        \ActualAngleZ = - \ActualAngleZ
      EndIf
      \Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
      \Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
      \Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
      ; delayed mode
      If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 40): EndIf
      ProcedureReturn
      
    Case "explode"
      \ActualTransparency = 0
      \Transform = #True
      ; movement
      \ActualPosX = \PosX + Random(ScreenWidth.l / 3) - ScreenWidth.l / 6
      \ActualPosY = \PosY + Random(ScreenWidth.l / 3) - ScreenWidth.l / 6
      \ActualPosZ = \PosZ + Random(ScreenWidth.l / 1) - ScreenWidth.l / 2
      If FindString(*Effect\Direction, "L", 1) > 0: \ActualPosX = \ActualPosX - ScreenWidth.l / 2: EndIf
      If FindString(*Effect\Direction, "R", 1) > 0: \ActualPosX = \ActualPosX + ScreenWidth.l / 2: EndIf
      If FindString(*Effect\Direction, "T", 1) > 0: \ActualPosY = \ActualPosY - ScreenHeight.l / 2: EndIf
      If FindString(*Effect\Direction, "B", 1) > 0: \ActualPosY = \ActualPosY + ScreenHeight.l / 2: EndIf
      \Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
      \Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
      \Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
      ; rotation
      \ActualAngleX = Random(3141) / 1000
      \ActualAngleY = Random(3141) / 1000
      \ActualAngleZ = Random(3141) / 1000
      \Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
      \Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
      \Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
      ; delayed mode
      If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
      
    Case "turn"
      \ActualTransparency = 0
      \Transform = #True
      ; movement
      \ActualPosZ = \ActualPosZ + 400
      If FindString(*Effect\Direction, "L", 1) > 0: \ActualPosX = \ActualPosX - 300: EndIf
      If FindString(*Effect\Direction, "R", 1) > 0: \ActualPosX = \ActualPosX + 300: EndIf
      If FindString(*Effect\Direction, "T", 1) > 0: \ActualPosY = \ActualPosY - 200: EndIf
      If FindString(*Effect\Direction, "B", 1) > 0: \ActualPosY = \ActualPosY + 200: EndIf
      \Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
      \Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
      \Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
      ; rotation
      If FindString(*Effect\Direction, "L", 1) > 0: \ActualAngleY = \ActualAngleY - #PI * 0.4: EndIf
      If FindString(*Effect\Direction, "R", 1) > 0: \ActualAngleY = \ActualAngleY + #PI * 0.4: EndIf
      If FindString(*Effect\Direction, "T", 1) > 0: \ActualAngleX = \ActualAngleX + #PI * 0.4: EndIf
      If FindString(*Effect\Direction, "B", 1) > 0: \ActualAngleX = \ActualAngleX - #PI * 0.4: EndIf
      \Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
      \Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
      \Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
      ; delayed mode
      If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
      
    Case "wave"
      \ActualTransparency = 0
      \Transform = #True
      ; movement
      \Val1 = (255 / #SpeedFactor)
      ; delayed mode
      If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
  EndSelect
  
  EndWith
      
EndProcedure

; initialize the outgoing effect for the OutObjects(CurrObject.l)
Procedure.l EffectInitOut(*Effect.structEffectParameters, ScreenWidth.l, ScreenHeight.l, CurrObject.l, GroupID.l, GroupMax.l)
  ; GroupID: which number of a group with GroupMax members am I?
  ; In case of no group (images?) set 1 and 1.
  With OutObjects(CurrObject.l)
    
  Select LCase(*Effect\Type)
    
    Case "standard" ; standard fade out effect
      \ActualTransparency = 255
      \Transform = #True
      \Delay = 0
      ; movement
      If FindString(*Effect\Direction, "L", 1) > 0: \PosX = \PosX - ScreenWidth.l : EndIf
      If FindString(*Effect\Direction, "R", 1) > 0: \PosX = \PosX + ScreenWidth.l : EndIf
      If FindString(*Effect\Direction, "T", 1) > 0: \PosY = \PosY - ScreenHeight.l : EndIf
      If FindString(*Effect\Direction, "B", 1) > 0: \PosY = \PosY + ScreenHeight.l : EndIf
      If FindString(*Effect\Direction, "F", 1) > 0: \PosZ = #InitialZ * 4: EndIf
      If FindString(*Effect\Direction, "V", 1) > 0: \PosZ = -100: EndIf
      \Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
      \Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
      \Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
      ; rotation
      If FindString(*Effect\Rotation, "X", 1) > 0: \AngleX = -8: EndIf
      If FindString(*Effect\Rotation, "Y", 1) > 0: \AngleY = -8: EndIf
      If FindString(*Effect\Rotation, "Z", 1) > 0: \AngleZ = -8: EndIf
      If FindString(*Effect\Rotation, "L", 1) > 0
        ; rotate left (counterclockwise)
        \AngleX = - \AngleX
        \AngleY = - \AngleY
        \AngleZ = - \AngleZ
      EndIf
      \Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
      \Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
      \Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
      ; delayed mode
      If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 40): EndIf
      ProcedureReturn
      
    Case "explode"
      \ActualTransparency = 255
      \Transform = #True
      \Delay = 0
      ; movement
      \Val0 = (Random(400) - 200) / (255 / #SpeedFactor) ; vector X
      \Val1 = (Random(400) - 200) / (255 / #SpeedFactor) ; vector Y
      \Val2 = (Random(800) - 400) / (255 / #SpeedFactor) ; vector Z
      If FindString(*Effect\Direction, "L", 1) > 0: \Val0 = \Val0 - #SpeedFactor*2: EndIf
      If FindString(*Effect\Direction, "R", 1) > 0: \Val0 = \Val0 + #SpeedFactor*2: EndIf
      If FindString(*Effect\Direction, "T", 1) > 0: \Val1 = \Val1 - #SpeedFactor*2: EndIf
      If FindString(*Effect\Direction, "B", 1) > 0: \Val1 = \Val1 + #SpeedFactor*2: EndIf
      ; rotation
      \Val3 = (Random(400) - 200) / 4000 ; rot X
      \Val4 = (Random(400) - 200) / 4000 ; rot Y
      \Val5 = (Random(400) - 200) / 4000 ; rot Z
      ; delayed mode
      If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
      ProcedureReturn
      
    Case "turn"
      \ActualTransparency = 255
      \Transform = #True
      \Delay = 0
      ; movement
      \PosZ = \PosZ + 400
      If FindString(*Effect\Direction, "L", 1) > 0: \PosX = \PosX - 200: EndIf
      If FindString(*Effect\Direction, "R", 1) > 0: \PosX = \PosX + 200: EndIf
      If FindString(*Effect\Direction, "T", 1) > 0: \PosY = \PosY - 200: EndIf
      If FindString(*Effect\Direction, "B", 1) > 0: \PosY = \PosY + 200: EndIf
      \Val0 = (\PosX - \ActualPosX) / (255 / #SpeedFactor) ; vector X
      \Val1 = (\PosY - \ActualPosY) / (255 / #SpeedFactor) ; vector Y
      \Val2 = (\PosZ - \ActualPosZ) / (255 / #SpeedFactor) ; vector Z
      ; rotation
      If FindString(*Effect\Direction, "L", 1) > 0: \AngleY = \AngleY - #PI * 0.4: EndIf
      If FindString(*Effect\Direction, "R", 1) > 0: \AngleY = \AngleY + #PI * 0.4: EndIf
      If FindString(*Effect\Direction, "T", 1) > 0: \AngleX = \AngleX + #PI * 0.4: EndIf
      If FindString(*Effect\Direction, "B", 1) > 0: \AngleX = \AngleX - #PI * 0.4: EndIf
      \Val3 = (\AngleX - \ActualAngleX) / (255 / #SpeedFactor)
      \Val4 = (\AngleY - \ActualAngleY) / (255 / #SpeedFactor)
      \Val5 = (\AngleZ - \ActualAngleZ) / (255 / #SpeedFactor)
      ; delayed mode
      If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
      ProcedureReturn
      
    Case "wave"
      \ActualTransparency = 255
      \Transform = #True
      \Delay = 0
      ; movement
      \Val1 = 0
      ; delayed mode
      If FindString(*Effect\Misc, "D", 1) > 0: \Delay = \Delay + ((GroupID.l - 1) * 30): EndIf
      ProcedureReturn
      
  EndSelect
  
  EndWith
      
EndProcedure

; -------------------------------------------------------------------------------------------
; TRANSFORMS
; -------------------------------------------------------------------------------------------

; do the ingoing effect for the InObjects(CurrObject.l)
Procedure EffectTransformIn(*Effect.structEffectParameters, ScreenWidth.l, ScreenHeight.l, CurrObject.l, MaxObjects.l)
  
  With InObjects(CurrObject.l)
  
  Select LCase(*Effect\Type)
    Case "standard", "explode", "turn" ; standard movement calculation
      \ActualTransparency = \ActualTransparency + #SpeedFactor
      
      \ActualPosX = \ActualPosX + \Val0
      \ActualPosY = \ActualPosY + \Val1
      \ActualPosZ = \ActualPosZ + \Val2
      \ActualAngleX = \ActualAngleX + \Val3
      \ActualAngleY = \ActualAngleY + \Val4
      \ActualAngleZ = \ActualAngleZ + \Val5
      
      If \ActualTransparency >= 255
        \ActualTransparency = 255
        \Transform = #False ; ready
      EndIf
      
      ProcedureReturn
      
    Case "wave" ; wave movement calculation
      \ActualTransparency = \ActualTransparency + #SpeedFactor
      \Val0 = \Val0 + 0.1
      \Val1 = \Val1 - 1
      If FindString(\EffectIn\Direction, "X", 1) > 0: \ActualPosX = \PosX + Sin(\Val0) * \Val1: EndIf
      If FindString(\EffectIn\Direction, "Y", 1) > 0: \ActualPosY = \PosY + Sin(\Val0) * \Val1: EndIf
      If FindString(\EffectIn\Direction, "Z", 1) > 0: \ActualPosZ = \PosZ + Sin(\Val0) * \Val1: EndIf
     
      If \ActualTransparency >= 255
        \ActualTransparency = 255
        \Transform = #False ; ready
      EndIf
      ProcedureReturn

  EndSelect

  EndWith
EndProcedure

; do the outgoing effect for the InObjects(CurrObject.l)
Procedure EffectTransformOut(*Effect.structEffectParameters, ScreenWidth.l, ScreenHeight.l, CurrObject.l, MaxObjects.l)
  
  With OutObjects(CurrObject.l)
    
  Select LCase(*Effect\Type)
    Case "standard", "explode", "turn" ; standard movement calcumaltion
      \ActualTransparency = \ActualTransparency - #SpeedFactor
      
      \ActualPosX = \ActualPosX + \Val0
      \ActualPosY = \ActualPosY + \Val1
      \ActualPosZ = \ActualPosZ + \Val2
      \ActualAngleX = \ActualAngleX + \Val3
      \ActualAngleY = \ActualAngleY + \Val4
      \ActualAngleZ = \ActualAngleZ + \Val5
      
      If \ActualTransparency < 1
        \ActualTransparency = 0
        \Transform = #False ; ready
      EndIf
      ProcedureReturn
      
    Case "wave" ; wave movement calculation
      \ActualTransparency = \ActualTransparency - #SpeedFactor
      
      \Val0 = \Val0 + 0.1
      \Val1 = \Val1 + 1
      If FindString(\EffectOut\Direction, "X", 1) > 0: \ActualPosX = \PosX + Sin(\Val0) * \Val1: EndIf
      If FindString(\EffectOut\Direction, "Y", 1) > 0: \ActualPosY = \PosY + Sin(\Val0) * \Val1: EndIf
      If FindString(\EffectOut\Direction, "Z", 1) > 0: \ActualPosZ = \PosZ + Sin(\Val0) * \Val1: EndIf
      
      If \ActualTransparency < 1
        \ActualTransparency = 0
        \Transform = #False ; ready
      EndIf
      ProcedureReturn

  EndSelect

  EndWith

EndProcedure

I'll remove it when the main source download is updated again
Last edited by Vera on Sun Oct 17, 2010 6:50 pm, edited 1 time in total.
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post by infratec »

Hi Vera,

here it is:
http://www.infratec-ag.de/PureBASIC/Pres3D_V1.08.zip

I check now for valid video modes.
I switch now also to a new window size after opening an other xml.
I correced the bug that it was not possible to jump to the last page.

Bernd

EDIT: Puh... 23 minutes :!:
A new record to fix your reported bugs :mrgreen: :mrgreen: :mrgreen:
Last edited by infratec on Sun Oct 17, 2010 6:23 pm, edited 1 time in total.
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post by infratec »

I only publish the files which I had modified.
So you have to download the original sourcecode from Kukulkan for the rest of the files.

Bernd
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Pres3D source

Post by Michael Vogel »

Thanks,
perfect service (include is also missing in the original package) :wink:

Maybe not the right time for doing polishing the GUI, but when I started the program, I saw two things:
• the window gets overlapped here (Windows XP) by the windows task bar
• the "Goto page" does not accept the Enter key.

Here are the changes for the second point:

Code: Select all

ButtonGadget(#GoGadget, 70, 10, 30, 20, "&Go",#PB_Button_Default)
SetActiveGadget(#PageGadget)
AddKeyboardShortcut(#GotoWindow,#PB_Shortcut_G|#PB_Shortcut_Alt,#GoGadget)
AddKeyboardShortcut(#GotoWindow,#PB_Shortcut_Return,#GoGadget)
:
Select Event
  Case #PB_Event_Gadget,#PB_Event_Menu
Hopefully a will have some time next week to do also some things here,
Michael
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post by infratec »

Hi,

I added a part of Michaels suggestions.
http://www.infratec-ag.de/PureBASIC/Pres3D_V1.09.zip

The goto value is now also accepted with the return key.
Personally I dont think that ALT+G makes sense.

The keyboard freaks (like me) using the number block and the return key (which is near by :mrgreen: ),
the mouse freaks try to find the button and click it :lol:

Bernd
PeterH
User
User
Posts: 26
Joined: Sun Apr 11, 2010 11:01 am

Re: Pres3D source

Post by PeterH »

infratec: I know this is old by now, but I was just looking for some inspiration to text effects and tried downloading this. Seems the page is not active anymore. Would you happen to have this somewhere to share yet again?

Edit: While I'm at it. This is quite a brilliant piece of code. if anyone else hasn't already done it already, I will try myself (despite being a bit short on time and skill) to dumb this down for simplicity as well as use in more "dynamic" projects. It would really be a fantastic addition for developing presentations, games, info displays etc.

/Peter
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post by infratec »

Hi,

sorry for the delay, but I had to convert it to PB 5.62 :wink:

Here is a link:

https://oc.ednt.de/index.php/s/X1mmGQep4xPv4GU

You should be able to create Pres3D.exe with it. Everything is included.

Bernd
PeterH
User
User
Posts: 26
Joined: Sun Apr 11, 2010 11:01 am

Re: Pres3D source

Post by PeterH »

infratec: You're the best. You probably also just saved me a couple of hours, approximately 3 keyboards and possibly a monitor (depending on frustration/rage if I'd have tried to do it myself).
Edit: Worked like a charm to compile. Just had to remember to switch to x86 due to the inline asm.

Kukulkan: And of course a huge thank your for you too for giving the original to the community!
User avatar
OldSkoolGamer
Enthusiast
Enthusiast
Posts: 148
Joined: Mon Dec 15, 2008 11:15 pm
Location: Nashville, TN
Contact:

Re: Pres3D source

Post by OldSkoolGamer »

Infratec,
Thank you for posting this. Funnily enough I was coming on the forum to look for this and BAM! there it was, even updated to 5.62. Saves me and others a TON of time, so once again, THANK YOU !!!
Gyros67
New User
New User
Posts: 1
Joined: Sun Sep 04, 2022 6:02 pm

Re: Pres3D source

Post by Gyros67 »

Hello Infratec
Unfortunately the link doesn't work for me.
Can you make the source code available again?

With best thanks
Gyros
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post by infratec »

Ups... we replaced OwnCloud by NextCloud, unfortunately the share is no longer available.
I have to search for the files.

Stay tuned.
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Pres3D source

Post by infratec »

Found it and uploaded it to my home page:

https://www.von-der-salierburg.de/downl ... Pres3D.zip

You can remove the DirectX9 subsystem by simply commenting out

Code: Select all

Define pd3d.IDirect3DDevice9
And the assembler part.

But then it is a bit slower. (Not tested with the C backend)
User avatar
❤x1
User
User
Posts: 46
Joined: Thu Jan 10, 2019 5:56 pm

Re: Pres3D source

Post by ❤x1 »

Just tried with the C compiler and it's quite fast, CPU utilization stays below 2% on a Ryzen 2700. 👍
Post Reply