Previous Thread
Next Thread
Print Thread
#120988 06/07/22 08:20 PM
Joined: Feb 2014
Posts: 852
Likes: 48
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 852
Likes: 48
Hi guys,

Was curious about bgfx and saw some examples on the website https://bkaradzic.github.io/bgfx/examples.html

I wanted to see if I could compile the examples from the included 3rdparty bgfx


[Linked Image from i.imgur.com]

[Linked Image from i.imgur.com]




3rdparty/bgfx$ make
Available targets:
clean Clean all intermediate files.
projgen Generate project files for all configurations.
idl Generate code from IDL.
android-arm-debug Build - Android ARM Debug
android-arm-release Build - Android ARM Release
android-arm Build - Android ARM Debug and Release
android-arm64-debug Build - Android ARM64 Debug
android-arm64-release Build - Android ARM64 Release
android-arm64 Build - Android ARM64 Debug and Release
android-x86-debug Build - Android x86 Debug and Release
android-x86-release Build - Android x86 Debug and Release
android-x86 Build - Android x86 Debug and Release
wasm2js-debug Build - Emscripten Debug
wasm2js-release Build - Emscripten Release
wasm2js Build - Emscripten Debug and Release
wasm-debug Build - Emscripten Debug
wasm-release Build - Emscripten Release
wasm Build - Emscripten Debug and Release
linux-debug64 Build - Linux x64 Debug
linux-release64 Build - Linux x64 Release
linux Build - Linux x86/x64 Debug and Release
freebsd-debug32 Build - FreeBSD x86 Debug
freebsd-release32 Build - FreeBSD x86 Release
freebsd-debug64 Build - FreeBSD x86 Debug
freebsd-release64 Build - FreeBSD x86 Release
freebsd Build - FreeBSD x86/x64 Debug and Release
mingw-gcc-debug32 Build - MinGW GCC x86 Debug
mingw-gcc-release32 Build - MinGW GCC x86 Release
mingw-gcc-debug64 Build - MinGW GCC x64 Debug
mingw-gcc-release64 Build - MinGW GCC x64 Release
mingw-gcc Build - MinGW GCC x86/x64 Debug and Release
mingw-clang-debug32 Build - MinGW Clang x86 Debug
mingw-clang-release32 Build - MinGW Clang x86 Release
mingw-clang-debug64 Build - MinGW Clang x64 Debug
mingw-clang-release64 Build - MinGW Clang x64 Release
mingw-clang Build - MinGW Clang x86/x64 Debug and Release
vs2017-debug32 Build - vs2017 x86 Debug
vs2017-release32 Build - vs2017 x86 Release
vs2017-debug64 Build - vs2017 x64 Debug
vs2017-release64 Build - vs2017 x64 Release
vs2017 Build - vs2017 x86/x64 Debug and Release
vs2017-winstore100-debug32 Build - vs2017-winstore100 x86 Debug
vs2017-winstore100-release32 Build - vs2017-winstore100 x86 Release
vs2017-winstore100-debug64 Build - vs2017-winstore100 x64 Debug
vs2017-winstore100-release64 Build - vs2017-winstore100 x64 Release
vs2017-winstore100 Build - vs2017-winstore100 x86/x64 Debug and Release
osx-debug Build - macOS Universal Debug
osx-release Build - macOS Universal Release
osx Build - macOS Universal Debug and Release
osx-x64-debug Build - macOS x64 Debug
osx-x64-release Build - macOS x64 Release
osx-x64 Build - macOS x64 Debug and Release
osx-arm64-debug Build - macOS ARM Debug
osx-arm64-release Build - macOS ARM Release
osx-arm64 Build - macOS ARM Debug and Release
ios-arm-debug Build - iOS ARM Debug
ios-arm-release Build - iOS ARM Release
ios-arm Build - iOS ARM Debug and Release
ios-arm64-debug Build - iOS ARM64 Debug
ios-arm64-release Build - iOS ARM64 Release
ios-arm64 Build - iOS ARM64 Debug and Release
ios-simulator-debug Build - iOS Simulator Debug
ios-simulator-release Build - iOS Simulator Release
ios-simulator Build - iOS Simulator Debug and Release
ios-simulator64-debug Build - iOS Simulator Debug
ios-simulator64-release Build - iOS Simulator Release
ios-simulator64 Build - iOS Simulator Debug and Release
rpi-debug Build - RasberryPi Debug
rpi-release Build - RasberryPi Release
rpi Build - RasberryPi Debug and Release
geometryc Build geometryc tool.
geometryv Build geometryv tool.
shaderc Build shaderc tool.
texturec Build texturec tool.
texturev Build texturev tool.
tools Build tools.
clean-tools Clean tools projects.




Since I'm on linux, I'll do make linux-release64


bgfx$ make linux-release64
make -R -C .build/projects/gmake-linux config=release64
==== Building bx (release64) ====
==== Building bgfx (release64) ====
==== Building bimg (release64) ====
==== Building bgfx-shared-lib (release64) ====
==== Building bimg_decode (release64) ====
==== Building bimg_encode (release64) ====
==== Building example-glue (release64) ====
==== Building example-common (release64) ====
==== Building example-17-drawstress (release64) ====
==== Building example-25-c99 (release64) ====
==== Building examples (release64) ====
Linking examples
Running post-build commands
Stripping symbols.
==== Building fcpp (release64) ====
==== Building geometryc (release64) ====
==== Building geometryv (release64) ====
==== Building glsl-optimizer (release64) ====
==== Building glslang (release64) ====
==== Building spirv-opt (release64) ====
==== Building spirv-cross (release64) ====
==== Building shaderc (release64) ====
==== Building texturec (release64) ====
==== Building texturev (release64) ====



and to run the examples you have to be in the examples/runtime directory and launch it with running the examplesRelease executable in the .build directory

mame/3rdparty/bgfx/examples/runtime$ ../../.build/linux64_gcc/bin/examplesRelease

Some of those examples are extremely impressive:

There's around 40 or so examples, a few crashed but most work.

mame/3rdparty/bgfx/examples/runtime$ ../../.build/linux64_gcc/bin/geometryvRelease meshes/bunny.bin

[Linked Image from i.imgur.com]


I wonder how hard it would be to render mame's output to a texture and put it on a 3d model.

Joined: May 2009
Posts: 2,048
Likes: 85
J
Very Senior Member
Offline
Very Senior Member
J
Joined: May 2009
Posts: 2,048
Likes: 85
What does this have to do with MAME other than your unrelated thought at the end? Start a blog or something. Please.

Joined: Mar 2001
Posts: 16,919
Likes: 57
R
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,919
Likes: 57
That and MAME's output *is* a texture when you're using BGFX (and, honestly, most of the other backends).

Joined: Feb 2014
Posts: 852
Likes: 48
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 852
Likes: 48
Experimenting with changing the view matrix.

[Linked Image from i.imgur.com]


Code
void bgfx_ortho_view::setup_matrices() {
        float proj[16];
        float view[16];
        const bgfx::Caps* caps = bgfx::getCaps();

//      bx::mtxIdentity(view);
        const bx::Vec3 at  = { float(m_view_width / 2.0), float(m_view_height / 2.0), 0.0f };
        const bx::Vec3 eye = { 900.0f, 600.0f, 1500.0f };
        const bx::Vec3 up = { 0.25f, -1.0f, 0.0f };
        bx::mtxLookAt(view, eye, at, up);

//      bx::mtxOrtho(proj, 0.0f, m_view_width, m_view_height, 0.0f, m_z_near, m_z_far, 0.0f, caps->homogeneousDepth);
        bx::mtxProj(proj, 60.0f, float(m_view_width) / float(m_view_height), 0.0f, 100.0f, caps->homogeneousDepth);

        bgfx::setViewTransform(m_index, view, proj);
}

1 member likes this: Dullaron
Joined: Apr 2006
Posts: 744
D
Senior Member
Offline
Senior Member
D
Joined: Apr 2006
Posts: 744
Nice you got the MAME menu moving with the game.

Last edited by Dullaron; 06/09/22 10:05 AM.

Windows 10 Home 64-bit / AMD Radeon RX 5700 XT / AMD Ryzen 7 3700X 8-Core 3.59 GHz / RAM 16 GB
Joined: Feb 2014
Posts: 852
Likes: 48
G
Senior Member
OP Online Content
Senior Member
G
Joined: Feb 2014
Posts: 852
Likes: 48
Here's a cool rotation spinning effect, I'd like to make it controllable with the mouse or keyboard.


in src/osd/modules/render/bgfx/view.cpp:
Code
void bgfx_ortho_view::setup_matrices() {
        float proj[16];
        float view[16];
        const bgfx::Caps* caps = bgfx::getCaps();

        static float rotation0 = 0.0;
        rotation0 += 0.0005;  // rotate at a slow speed
        static float rotation1 = 3.14 / 2.0;
        rotation1 += 0.0005;
        static float rotation2 = 3.14 / 2.0;
        rotation2 += 0.0005;

        const bx::Vec3 at  = { float(m_view_width / 2.0), float(m_view_height / 2.0), 0.0f };

// rotate in a horizontal circle
//        const bx::Vec3 eye = { float(cos(rotation0)*1000 + m_view_width / 2.0f), float( m_view_height / 2.0f), float(sin(rotation0)*1000) };
// rotate in a vertical circle
        const bx::Vec3 eye = { float(m_view_width / 2.0f), float(cos(rotation1)*1000 + m_view_height / 2.0f), float(sin(rotation1)*1000) };

//        const bx::Vec3 up = { 0.0f, -1.0f, 0.0f };  // straight up

        const bx::Vec3 up = { float(cos(rotation2)), float(-sin(rotation2)), 0.0f };


        bx::mtxLookAt(view, eye, at, up);

        bx::mtxProj(proj, 60.0f, float(m_view_width) / float(m_view_height), 0.0f, 100.0f, caps->homogeneousDepth);

        bgfx::setViewTransform(m_index, view, proj);
}


1 member likes this: Dullaron
Joined: Mar 2013
Posts: 331
Likes: 1
I
Senior Member
Offline
Senior Member
I
Joined: Mar 2013
Posts: 331
Likes: 1
I think you can already do those things from the sliders menu in base MAME, including adding curvature to the monitor.


LCD artwork scans and cleanups: https://mega.nz/#F!uFYSzK7S!U-lJon9jsqyoCX_3y7_KLA
Joined: Apr 2006
Posts: 744
D
Senior Member
Offline
Senior Member
D
Joined: Apr 2006
Posts: 744
Screen saver effect.


Windows 10 Home 64-bit / AMD Radeon RX 5700 XT / AMD Ryzen 7 3700X 8-Core 3.59 GHz / RAM 16 GB
Joined: May 2009
Posts: 2,048
Likes: 85
J
Very Senior Member
Offline
Very Senior Member
J
Joined: May 2009
Posts: 2,048
Likes: 85
Originally Posted by ICEknight
I think you can already do those things from the sliders menu in base MAME, including adding curvature to the monitor.

You could conceivably define sliders in JSON, then modify the vertex shader to take those values and construct view/projection matrices based on values specified with those sliders. However, you would need to be running Windows in order to compile the new shader as well.


Link Copied to Clipboard
Who's Online Now
2 members (Golden Child, 1 invisible), 16 guests, and 3 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,100
Posts119,229
Members5,019
Most Online890
Jan 17th, 2020
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com