3D challenge for a special rotation

Everything related to 3D programming
User avatar
Psychophanta
Addict
Addict
Posts: 4975
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

3D challenge for a special rotation

Post by Psychophanta »

Purpose of a 3D challenge.
Just get the executeable (put first the 'Engine3D.dll' in the system directory or in the same dir than the executeable)

After run it, you can see an object (Entity) which can be rotated using mouse movements, and the rotation of the entity is such that it rotates in the same direction as the mouse movements.

Now, while pushing left-control key and moving mouse, the camera orbitates around the object in the world.

Again, pop the left-control key and you can see ALWAYS the object rotates in the same direction as the mouse movements, nevertheless the camera looking vector is.

The issue seems trivial. So, I don't give you any code, just try to do with your own code; will see the triviality of it :twisted:

By the way, I have not seen any 3D CAD-CAM program which do that: at least Catia, Solidworks, Inventor, Cinema4D, Blender, Rhinoceros, Sketchup, AutoCAD do not it. Why? I don't know.
windows 32bit : https://www.dropbox.com/s/hels4zqy29y16 ... tation.exe
windows 64bit : https://www.dropbox.com/s/55ru9ynhm9376 ... nwin64.exe
Last edited by Psychophanta on Mon Mar 11, 2019 8:37 pm, edited 1 time in total.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: 3D challenge for a special rotation

Post by TI-994A »

Just for the fun of it, my very first 3D code, cobbled together from the samples.

Code: Select all

Define keyX.f, mouseX.f, wFlags = #PB_Window_SystemMenu | #PB_Window_ScreenCentered,
       keys$ = "Mouse & Left/Right Arrows to move - Spacebar to stop - ESC to quit"

If InitEngine3D() And InitSprite() And InitKeyboard() And InitMouse() And
   OpenWindow(0, 0, 0, 800, 600, "3D Challenge - " + keys$, wFlags) And
   OpenWindowedScreen(WindowID(0), 0, 0, 800, 600, 0, 0, 0)    
  
  KeyboardMode(#PB_Keyboard_International) 
  
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Textures", #PB_3DArchive_FileSystem)
  Add3DArchive(#PB_Compiler_Home + "examples/3d/Data/Packs/desert.zip", #PB_3DArchive_Zip)            
  
  CreateSphere(0, 9)
  CreateMaterial(0, TextureID(LoadTexture(#PB_Any, "glass.png")))            
  CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, -10)
  CreateLight(0, RGB(150, 200, 200), 200, 200, 200)
  AmbientColor(RGB(220, 30, 30))      
  SkyBox("desert07.jpg")
  CreateCamera(0, 0, 0, 100, 100)
  MoveCamera(0, 0, 0, 50, #PB_Absolute)
  
  Repeat
    
    Repeat
      event = WindowEvent()
      Select event
        Case #PB_Event_CloseWindow
          appQuit = 1
      EndSelect      
    Until event = 0
        
    If ExamineMouse()            
      lastMouseX = mouseX
      mouseX = -MouseDeltaX() * 0.5 * 0.05
      If mouseX <> lastMouseX
        keyX = 0
        MoveCamera(0, mouseX, 0, 0)
        RotateCamera(0, 0, mouseX, 0, #PB_Relative) 
      EndIf      
    EndIf
    
    If ExamineKeyboard()        
      If KeyboardPushed(#PB_Key_Left)
        keyX = -0.5
      ElseIf KeyboardPushed(#PB_Key_Right)
        keyX = 0.5
      ElseIf KeyboardPushed(#PB_Key_Space)
        keyX = 0
      ElseIf KeyboardPushed(#PB_Key_Escape)
        appQuit = 1
      EndIf          
      MoveCamera(0, keyX, 0, 0)
      RotateCamera(0, 0, keyX, 0, #PB_Relative)              
    EndIf    
    
    RenderWorld()
    FlipBuffers()
    
  Until appQuit      
EndIf
Educational, to say the least; but most of all, fun! :lol:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Psychophanta
Addict
Addict
Posts: 4975
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: 3D challenge for a special rotation

Post by Psychophanta »

Welcome to 3D world !
Walk more inside and then will see 3D programming is not much to do with other programming. :wink:
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: 3D challenge for a special rotation

Post by TI-994A »

Psychophanta wrote:...3D programming is not much to do with other programming. :wink:
Very true. Everything's handled by the rendering engine; we're basically scripting. Testing out the various examples in the 3D folder was a real eye-opener; demystifying!
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
ymerdy
User
User
Posts: 10
Joined: Thu Jan 18, 2018 11:54 pm

Re: 3D challenge for a special rotation

Post by ymerdy »

Hello,

I have copied the Engine3D.dll in the same dir than the executable, and I still have the message "the 3D engine can't be initialized".
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: 3D challenge for a special rotation

Post by TI-994A »

ymerdy wrote:I have copied the Engine3D.dll in the same dir than the executable, and I still have the message "the 3D engine can't be initialized".
Which example are you trying to run? And does it work in the PureBasic IDE?
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Psychophanta
Addict
Addict
Posts: 4975
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: 3D challenge for a special rotation

Post by Psychophanta »

ymerdy wrote:Hello,

I have copied the Engine3D.dll in the same dir than the executable, and I still have the message "the 3D engine can't be initialized".
Must be the 'Engine3D.dll' file you find inside "C:\programfiles\PureBasic5.70\Compilers".
'Engine3D.dll' 5.70 PB version.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
ymerdy
User
User
Posts: 10
Joined: Thu Jan 18, 2018 11:54 pm

Re: 3D challenge for a special rotation

Post by ymerdy »

Hello,

yes, that's what I did, I copied the dll from PB 5.70 version, but the exe don't start...
User avatar
Psychophanta
Addict
Addict
Posts: 4975
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: 3D challenge for a special rotation

Post by Psychophanta »

ymerdy wrote:Hello,

yes, that's what I did, I copied the dll from PB 5.70 version, but the exe don't start...
That is very strange, but sure there is something wrong, i can not help you, sorry.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: 3D challenge for a special rotation

Post by djes »

Psychophanta wrote:
ymerdy wrote:Hello,

yes, that's what I did, I copied the dll from PB 5.70 version, but the exe don't start...
That is very strange, but sure there is something wrong, i can not help you, sorry.
Needs x86 version, not x64.
ymerdy
User
User
Posts: 10
Joined: Thu Jan 18, 2018 11:54 pm

Re: 3D challenge for a special rotation

Post by ymerdy »

OK, with x86 version, it works
Thanx!
User avatar
NicTheQuick
Addict
Addict
Posts: 1224
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: 3D challenge for a special rotation

Post by NicTheQuick »

Why are they still people using the 32 bit versions? This is old stuff, use it only if there is no other way.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
Psychophanta
Addict
Addict
Posts: 4975
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: 3D challenge for a special rotation

Post by Psychophanta »

NicTheQuick wrote:Why are they still people using the 32 bit versions? This is old stuff, use it only if there is no other way.
:lol:
Sorry, I work with linux 64bit and XP 32bit.
XP is much faster than 7, 8.1 and 10. I don't support a OS slower than myself.
That IS a true, so my OS is XP and linux, because i use computer to produce.

But you are right, most people use 64bit. So uploaded win64 bit in first post.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
User avatar
NicTheQuick
Addict
Addict
Posts: 1224
Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:

Re: 3D challenge for a special rotation

Post by NicTheQuick »

If you are still using XP you've got much more problems than a slow machine. Kill it with fire, upgrade to Windows 7 or 10 or delete it completely to switch to Linux. But don't use operating systems with security holes and old encryption techniques in combination with internet. As a programmer you should know what that means. Hopefully...
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
User avatar
Psychophanta
Addict
Addict
Posts: 4975
Joined: Wed Jun 11, 2003 9:33 pm
Location: Lípetsk, Russian Federation
Contact:

Re: 3D challenge for a special rotation

Post by Psychophanta »

NicTheQuick wrote:If you are still using XP you've got much more problems than a slow machine. Kill it with fire, upgrade to Windows 7 or 10 or delete it completely to switch to Linux. But don't use operating systems with security holes and old encryption techniques in combination with internet. As a programmer you should know what that means. Hopefully...
This is full off topic.
Well I use it since 2003, with no antivirus never, with no problems.

Windows 7, 8 and 10 are virus itselves, and a undefined amount of lacks , slowing , and problems.
The first thing i got very scared was this simple example:
In a spanish installation of 7, 8, 8.1, or 10, in C: (system partition) there is not appear a folder named "Program files", however system does not allow to create a folder named "Program files".
This fact is just a sympthom the entire system IS A VIRUS.
http://www.zeitgeistmovie.com

While world=business:world+mafia:Wend
Will never leave this forum until the absolute bugfree PB :mrgreen:
Post Reply