Commit Graph

26 Commits

Author SHA1 Message Date
Brian Gianforcaro
6c0329c806 3DFileViewer: Use ElapsedTimer::start_new() 2021-09-12 17:24:44 +00:00
Timothy
1c78ff1b9f 3DFileViewer: Use unveil and FileSystemAccessServer
This will restrict 3DFileViewer's access to the file system.

3DFileViewer loads a texture based on the path of the model loaded, this
will request access to the texture file before loading.
2021-09-09 02:34:29 +02:00
Dawid Wolosowicz
977b62a213 3DFileViewer: Maintain the FPS counter's position
Without this, any resize of the GLContextWidget might leave the label
somewhere it shouldn't be. Toggling fullscreen is a single example of
that behavior.
2021-09-01 23:04:10 +02:00
Stephan Unverwerth
addbcd42d7 LibGL: Fix triangle winding calculation
Since we operate in screen space where y points down we need to reverse
what is considered clock wise and what is considered counter clockwise.

The rasterizer always expects triangles with a consistent winding order
thus swap 2 vertices if necessary to reverse the winding before passing
the triangle on to the rasterization stage.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
22905daacb LibGL: Fix interpretation of BGRA byte order
This fixes byte order interpretation in several places.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
5e27da20f4 LibGL: Fix glTexCoord behaviour
glTexCoord should behave like glColor. It only updates a gl context
variable that contains the current texture coordinates. The vertex is
only actually created once glVertex is called.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
b6373c2aba LibGL+3DFileViewer: Make glRotatef accept degrees, not radians
This is in accordance with the GL spec. Also adjust rotation values in
3DFileViewer to take the new units into account.
2021-08-18 20:30:58 +02:00
Stephan Unverwerth
e405f436b6 3DFileViewer: Allow zooming via mouse wheel 2021-08-12 20:57:19 +02:00
Stephan Unverwerth
3c509cf2f7 3DFileViewer: Add magnification filters to texture menu 2021-08-12 20:57:19 +02:00
Stephan Unverwerth
75bc7be622 3DFileViewer: Add texture menu
This allows setting different texture wrap modes
and setting different texture coordinate scale factors.
2021-08-12 18:58:41 +02:00
K-Adam
9758ba5678 3DFileViewer: Display frame rate optionally
It is turned off by default
2021-08-01 17:41:26 +02:00
Brian Gianforcaro
a51e6547aa Applications: Remove unused header includes 2021-08-01 08:10:16 +02:00
Andreas Kling
687a12d7fb Userland: Add GUI::Window::add_menu() and use it everywhere
Applications previously had to create a GUI::Menubar object, add menus
to it, and then call GUI::Window::set_menubar().

This patch introduces GUI::Window::add_menu() which creates the menubar
automatically and adds items to it. Application code becomes slightly
simpler as a result. :^)
2021-07-21 21:24:26 +02:00
Andreas Kling
c7d891765c LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
2021-07-21 18:02:15 +02:00
Noah Rosamilia
2feaf59ab2 3DFileViewer: Add primitive mouse controls 2021-07-03 04:02:52 +02:00
Gunnar Beutner
631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Ali Mohammad Pur
51c2c69357 AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
2021-06-06 00:27:30 +04:30
Stephan Unverwerth
755393e684 LibGL: Implement glBindTexture()
Textures are now initialized with a nullptr upon generation.
They are only actually created once they are bound to a target.
Currently only the GL_TEXTURE_2D target is supported.
The software rasterizer now allows rendering with or without
a bound TEXTURE_2D.
2021-05-30 00:32:37 +01:00
Linus Groh
ffad5b1706 3DFileViewer: Add separator before quit menu action 2021-05-27 18:11:03 +01:00
Erik Biederstadt
3ea256b1c6 3DFileViewer: Add view menu
The view menu contains:
1. A fullscreen option (also accessed by pressing F11).
2. Rotation axis controls (x, y, z, or any combination)
3. Rotation speed controls (No rotation, slow, normal, or fast)
2021-05-27 08:57:13 +01:00
Jesse Buhagiar
343e66b816 3DFileViewer: Support textured models
Models that contain UV co-ordinates are now supported,
and will display with a texture wrapped around it, provided
a `bmp` with the same name as the object is in the same
directory as the 3D Model.
2021-05-26 16:36:53 +04:30
Andreas Kling
6048e245ee 3DFileViewer: Make the main widget a GUI::Frame 2021-05-21 16:14:40 +02:00
Gunnar Beutner
2a16c8bdb8 3DFileViewer: Clean up file handling
This unifies how 3DFileViewer handles the initial file when starting
the application and when opening files later on via the menu.

Errors are shown both for the initial load as well as when loading
files later on. An error during file load no longer clears the
existing model.

It also adds support for specifying the filename as a command-line
argument.

The opened file's name is shown in the titlebar.
2021-05-20 22:22:56 +02:00
Gunnar Beutner
728e6dad73 3DFileViewer: Move the example model into the home directory 2021-05-20 22:22:56 +02:00
Andreas Kling
df5f382b50 3DFileViewer: Remove unveil() calls and add "thread" pledge
An application that allows opening arbitrary files from the filesystem
needs to allow itself to access the filesystem, otherwise there's no
point in supporting the feature. :^)

And the "thread" pledge is needed for background thumbnail generation.
2021-05-20 17:52:38 +02:00
Erik Biederstadt
585e7890cd 3DFileViewer: Move Demos/GLTeapot to Applications/3DFileViewer
Also changes the category to `Graphics`
2021-05-19 19:34:12 +01:00