Commit graph

387 commits

Author SHA1 Message Date
Gered fbba97f168 normalize the resulting re-calculated "up" vector 2024-09-08 20:18:51 -04:00
Gered c3c6f1338d add Vector4 and Matrix4x4 multiplication 2024-09-08 18:42:49 -04:00
Gered 4156486228 add Vector4 2024-09-08 18:27:02 -04:00
Gered 1d09340c83 add a bunch of rustfmt::skip's because rustfmt is a piece of shit
apparently the trailing comment trick doesn't work that well anymore?
or maybe only in certain cases?

oh well. rustfmt can fuck right off.
2024-09-08 16:23:58 -04:00
Gered 7111624a7e add Matrix4x4 methods for creating projection and modelview matrices
these all mimic OpenGL functions
2024-09-08 15:47:36 -04:00
Gered 1f564253e3 Merge branch 'master' into 3dmath 2024-09-07 23:11:15 -04:00
Gered 16eb66b219 address a number of cargo warnings and clippy lints
while also ignored some bullshit clippy lints
2024-09-07 21:21:49 -04:00
Gered 040e480dd0 fix events::adding_and_removing_listeners test failure in release mode
best guess is that release mode optimizations collapsed these two
functions into one, because in release mode the assertion that would
fail was:

    assert!(listeners.add(other_dummy_listener));

which would mean that `listeners.add()` thought it was trying to add
a duplicate listener function.

adding dummy println's is a simple way to ensure that the compiler
won't try to collapse these thinking that they are the same function.
2024-09-07 17:12:34 -04:00
Gered d9e26556e6 fix simd imports 2024-09-07 16:51:36 -04:00
Gered ed95332699 update toolchain 2024-09-07 16:51:24 -04:00
Gered c7d6bd8aef revert app_root_dir usages in examples. re-org example asset files
ultimately, cargo workspaces are kind of weird. you can do things like
`cargo run` from the top-level cargo.toml file and run an individual
sub-module via `--bin`, or you can go to that sub-module's directory
where it's own cargo.toml is, and `cargo run` directly from there.

the current working directory will be different in each case, and this
difference can be very annoying when you want to do seemingly-logical
things like organize sub-module "asset" files (e.g. images, and other
types of data files that aren't code) within that sub-module's
directory. in this case, how do you write code in that sub-module that
can load those asset files in a way that will work in BOTH of the
aforementioned scenarios for `cargo run`?

you can't really! some people use the `CARGO_MANIFEST_DIR` environment
variable that cargo sets when running any given cargo module, but this
is only a valid method for obtaining the module's root directory when
running from a cargo command ... which you won't be doing when running
within a debugger! likely you or your IDE invoked the debugger process
against the already built executable directly, so `CARGO_MANIFEST_DIR`
will not be set and you're back to square one!

super annoying!

as such, i am now giving up and am just doing what it seems like most
other cargo projects that utilize workspaces do ... place all the
assets for all sub-modules together in the same directory, relative
to the workspace root.

why go with this approach?

because it works under the most common scenarios (but NOT all!):
- running via `cargo run --bin` from the workspace root
- debugging via gdb/lldb etc using the workspace root as the cwd

these seem to be the most common ways to do each type of task from
any rust-equipped editor/IDE that i've seen so far.
2024-09-05 22:35:20 -04:00
Gered 4d359f3e3c update all explicit Path instance allocation and use
previously, there were a ton of places that were allocating new Path
instances via `Path::new` for the purpose of creating a path to be
passed into a function as a Path argument

this has now been simplified everywhere by updating all functions
and methods that previously took Path arguments to instead take
AsRef<Path> arguments, allowing much more flexibility in the types
of path arguments passed in
2024-09-04 00:31:30 -04:00
Gered a18aee300d ignore some clippy warnings 2024-09-03 00:06:52 -04:00
Gered 0cbd5366fd add app_root_dir helper function. integrate with all examples 2024-09-03 00:00:07 -04:00
Gered 2c5af8d559 add Matrix4x4
will be expanded upon later with more useful methods
2024-08-11 16:47:28 -04:00
Gered dc29f29289 add vector3 2024-07-21 18:15:44 -04:00
Gered 74d7f2b22c use workspace.dependencies for common dependency versions 2024-07-21 16:07:33 -04:00
Gered 389e27afe0 add Copy trait to BitmaskCharacter 2023-11-11 19:34:41 -05:00
Gered 053f95a929 add more ability to create/modify BitmaskCharacter instances 2023-11-11 19:29:04 -05:00
Gered f864592361 add methods to bitmask font/char structs to allow creation of new fonts 2023-11-11 19:04:08 -05:00
Gered 39c88567b5 downgrade to flate2 v1.0.27 due to performance issues
dev/test builds that heavily use deflate (e.g. anything with png files)
perform *incredibly* slow with 1.0.28. also tried switching the backend
to zlib which didn't really speed things up too much.

i hate updating dependencies. *sigh*
2023-11-11 17:59:41 -05:00
Gered 9d02e23e9a explicitly set workspace resolver to address cargo warning
since we're using 2021 edition, resolver = 2 is the default, but this
apparently needs to be explicitly set at the workspace level
2023-11-11 13:54:28 -05:00
Gered 0f8377455c update dependencies 2023-11-11 13:52:58 -05:00
Gered 3e88e41265 helper method for clearing imgui window focus
so that no window is focused at all
2023-06-03 17:10:46 -04:00
Gered 6aabe45fbd minor cleanup 2023-06-01 10:34:10 -04:00
Gered 81de65c8d0 bump to more recent nightly channel
the previous "illegal instruction" issues that i was getting on release
builds seems to have been resolved
2023-05-30 19:22:41 -04:00
Gered 3beb0f3449 Merge remote-tracking branch 'origin/master' 2023-05-30 18:52:39 -04:00
Gered 8557c24d48 add image_region ui widget which allows specifying a texture sub-region 2023-05-30 18:51:29 -04:00
Gered d80720f772 update image ui widget to return a bool with its clicked state 2023-05-30 18:50:20 -04:00
Gered d903ca59b3 add methods to get current ImGui display size
i suppose there is not much benefit to using this versus equivalent
functionality on SystemResources (for example). however the dimensions
returned by these new methods do respect whatever display scaling is
being used by ImGui. and these are technically more convenient to use
in whatever place you're building up a UI in. meh.
2023-05-30 18:49:14 -04:00
Gered df62205e41 add convenience method for getting uv coords for BitmapAtlas tiles 2023-05-30 18:46:40 -04:00
Gered ad8d1f9ae3 i have no idea why this decided to throw a compile error now? wtf?
my wild-ass guess is this is somehow related to the serde dependency
being included now, but who the fuck knows. what a joke.
2023-05-29 14:30:00 -04:00
Gered f5291a4d60 add support for loading and saving BitmapAtlas "descriptor" json files
as well as support for directly instantiating a BitmapAtlas from
such a descriptor.

saving a BitmapAtlas to a descriptor file directly is not added (yet?)
as my gut feeling is that these files would probably be hand-written?
saving from a BitmapAtlas directly would (in a simple/naive impl)
always result in a long-ish list of "tiles" anyway, since grids are
turned into tiles. this further reinforces me feeling that you'd either
write these files by hand, or at the very least, just construct a
descriptor instance in code somehow and save that
2023-05-29 14:29:12 -04:00
Gered 4f3a629f5a simplify
how did i not see this. lol
2023-05-26 21:09:37 -04:00
Gered afa7a92709 add checks for valid rect dimensions in BitmapAtlas 2023-05-26 13:22:26 -04:00
Gered b03b8f4915 add tests for BitmapAtlas.add_grid which were apparently forgotten 2023-05-26 13:21:25 -04:00
Gered ec6d0f1b73 convenience method for creating a basic image widget 2023-05-26 12:12:45 -04:00
Gered 3bb12fdcee update imgui example with image widgets showing slime colors/bitmaps 2023-05-26 12:04:02 -04:00
Gered 73e64946f7 convenience method to clone single BitmapAtlas tiles as new bitmaps 2023-05-26 11:58:30 -04:00
Gered 4257985962 access to the imgui texture map from our own imgui wrapper struct 2023-05-26 11:20:58 -04:00
Gered f6ef1ee22e add support for resetting the imgui renderer's texture map 2023-05-26 11:11:27 -04:00
Gered 457aa757cf simplify 2023-05-05 18:15:55 -04:00
Gered 3a56926345 the big switch from ARGB to RGBA format for 32-bit color pixels 2023-05-05 18:14:37 -04:00
Gered 78d8102a23 rename color types to somewhat less "noisy" names
plus these are easier to type.

i do not anticipate needing structured color types for any other
type of components (e.g. i don't see a need for an ARGBu16x4, etc).
so i am fine with just having `ARGB` being associated with four u8's
with no real indication of this in the type name itself.
2023-05-05 15:56:29 -04:00
Gered ae178e1fa0 remove old argb color functions 2023-05-05 15:32:57 -04:00
Gered 02447867a9 add doc comments for the new color types 2023-05-05 14:41:27 -04:00
Gered 09dbb913a5 convert RgbaBitmap to use ARGBu8x4 as its pixel type 2023-05-04 18:54:37 -04:00
Gered cf92d42b84 update Pixel trait to just the bare minimum requirements
our target is IndexedBitmap's will use PixelType=u8 and
RgbaBitmap's will use PixelType=ARGBu8x4

thus, restricting the Pixel trait to primitive unsigned numerics won't
work anymore, but we do still need to support basic stuff like
equality testing and copy/clone support for our generic bitmap
operations
2023-05-03 16:57:13 -04:00
Gered 579398ea5e use manual impls of Debug and Display for ARGBu8x4 and ARGBf32x4
simply because i wanted a specific format, mostly for ARGBu8x4 and
the barebones hex format string
2023-05-03 16:42:26 -04:00
Gered 0eac3ad7a3 make ARGBu8x4 and ARGBf32x4 derive Default 2023-05-03 16:09:30 -04:00