awlib.git
8 months agohdf: Add utility functions master
Hudd [Fri, 8 Mar 2019 22:15:49 +0000 (01:15 +0300)]
hdf: Add utility functions

I took them from Havogrek, these are high-level wrappers for parser
class. I did some minor cleanup, because this was C++98 code.

8 months agohdf: Rewrite node class
Hudd [Fri, 8 Mar 2019 22:13:12 +0000 (01:13 +0300)]
hdf: Rewrite node class

I took the new code from Havogrek, I am not sure why the newer version
of node wasn't committed into this repository, it is 3 years old by now.

8 months agohdf: Convert writer to snake_case
Hudd [Thu, 7 Mar 2019 10:45:01 +0000 (13:45 +0300)]
hdf: Convert writer to snake_case

8 months agoFix more of missing returns
Hedede [Tue, 5 Mar 2019 13:33:47 +0000 (16:33 +0300)]
Fix more of missing returns

8 months agoAdd missing return in gl::load_functions
Hedede [Tue, 5 Mar 2019 13:30:16 +0000 (16:30 +0300)]
Add missing return in gl::load_functions

It is a temporary fix, because it should return something different
(maybe a simple bool will suffice?)
It wan't a prooblem, because func is static, but since blah blah
swithced -Werror on

8 months agohdf: Update reader example
Hudd [Mon, 4 Mar 2019 12:48:20 +0000 (15:48 +0300)]
hdf: Update reader example

8 months agohdf: Fix return-type compile errors
Hudd [Mon, 4 Mar 2019 12:47:51 +0000 (15:47 +0300)]
hdf: Fix return-type compile errors

8 months agoAdd default case for ostream_logger
Hedede [Tue, 5 Mar 2019 13:26:06 +0000 (16:26 +0300)]
Add default case for ostream_logger

9 months agoutility: Add hash_combine
Hedede [Mon, 21 Jan 2019 03:47:24 +0000 (06:47 +0300)]
utility: Add hash_combine

It is based on popular version which is also found in boost.
I added a rotate (so that xor's don't cancel out) and a bigger prime for
64 bit values.

9 months agomath: Replace rotl/rotr with template function
Hedede [Mon, 21 Jan 2019 03:09:57 +0000 (06:09 +0300)]
math: Replace rotl/rotr with template function

+ Works for all unsigned integral types
+ Now constexpr
- I've removed MSVC built-ins because
C2131: expression did not evaluate to a constant
- It doesn't have an optimization built into it, but oh well

10 months agoBuild: Add -Werror=return-type
Hudd [Mon, 14 Jan 2019 18:54:58 +0000 (21:54 +0300)]
Build: Add -Werror=return-type

I forget the return inside operator= quite often.

10 months agogl3: Fix missing returns in assinment operators
Hudd [Mon, 14 Jan 2019 18:51:38 +0000 (21:51 +0300)]
gl3: Fix missing returns in assinment operators

This also caused a crash in resource manager.

10 months agoranges: Fix missing return in ipairs
Hudd [Mon, 14 Jan 2019 18:50:07 +0000 (21:50 +0300)]
ranges: Fix missing return in ipairs

10 months agocontainers: Fix allocator type in flat_map
Hudd [Mon, 14 Jan 2019 18:47:53 +0000 (21:47 +0300)]
containers: Fix allocator type in flat_map

Curiously, this is UB.

18 months agomath: C++17ify math.h
Hudd [Sat, 5 May 2018 11:44:00 +0000 (14:44 +0300)]
math: C++17ify math.h

18 months agomath: Improve the description of lerp()
Hudd [Sat, 5 May 2018 11:08:33 +0000 (14:08 +0300)]
math: Improve the description of lerp()

18 months agoplatform: Add missing `using`s
Hudd [Sun, 29 Apr 2018 18:16:01 +0000 (21:16 +0300)]
platform: Add missing `using`s

18 months agotypes: Extend array_view test
Hudd [Sun, 29 Apr 2018 18:11:41 +0000 (21:11 +0300)]
types: Extend array_view test

18 months agoplatform: Add spawn & friends io-process
Hudd [Sun, 29 Apr 2018 17:31:14 +0000 (20:31 +0300)]
platform: Add spawn & friends

(Migrated from drpd)

18 months agotypes: Fix critical mistake in array_view::back()
Hudd [Sun, 29 Apr 2018 17:50:42 +0000 (20:50 +0300)]
types: Fix critical mistake in array_view::back()

18 months agoplatform: Update os_version test
Hudd [Sun, 29 Apr 2018 13:19:58 +0000 (16:19 +0300)]
platform: Update os_version test

18 months agoplatform: Move demangle strings into separate file
Hudd [Sun, 29 Apr 2018 13:18:34 +0000 (16:18 +0300)]
platform: Move demangle strings into separate file

18 months agoplatform: Remove old outdated code
Hudd [Sun, 29 Apr 2018 13:13:58 +0000 (16:13 +0300)]
platform: Remove old outdated code

18 months agomath: Add make_inverse_transform
Hudd [Fri, 27 Apr 2018 11:13:37 +0000 (14:13 +0300)]
math: Add make_inverse_transform

18 months agoFix build error
Hudd [Sun, 22 Apr 2018 12:33:13 +0000 (15:33 +0300)]
Fix build error

It is annoying when other headers mask the error.

18 months agographics: Improve shader loader utilities
Hudd [Sun, 22 Apr 2018 12:27:01 +0000 (15:27 +0300)]
graphics: Improve shader loader utilities

18 months agotypes: Add initializer list support to array_view
Hudd [Sun, 22 Apr 2018 12:26:24 +0000 (15:26 +0300)]
types: Add initializer list support to array_view

18 months agomath: Add make_transform()
Hudd [Sat, 21 Apr 2018 21:27:46 +0000 (00:27 +0300)]
math: Add make_transform()

18 months agographics: Fix incorrect usage of transpose()
Hudd [Sat, 21 Apr 2018 21:19:30 +0000 (00:19 +0300)]
graphics: Fix incorrect usage of transpose()

18 months agographics: Add few uasages of extend()
Hudd [Sat, 21 Apr 2018 21:18:05 +0000 (00:18 +0300)]
graphics: Add few uasages of extend()

18 months agomath: Rename expand_matrix() -> extend()
Hudd [Sat, 21 Apr 2018 21:14:23 +0000 (00:14 +0300)]
math: Rename expand_matrix() -> extend()

I believe this name is more correct. Dropped _matrix, because it is
shorter to read this way and it is already unambigous.

18 months agomath: Add translation_matrix()
Hudd [Sat, 21 Apr 2018 21:10:41 +0000 (00:10 +0300)]
math: Add translation_matrix()

Quite useful utility, should've made it earlier.

18 months agomath: Fix look_at_inverse
Hudd [Sat, 21 Apr 2018 20:56:21 +0000 (23:56 +0300)]
math: Fix look_at_inverse

I forgot that inversing a product of two matrices also inverses order of
operations.

(A·B)⁻¹ = B⁻¹·A⁻¹                   (1)

18 months agomath: Replace pow(1./3.) with cbrt()
Hudd [Sat, 21 Apr 2018 19:47:28 +0000 (22:47 +0300)]
math: Replace pow(1./3.) with cbrt()

It is more accurate (and probably performant).

(Good thing I noticed this)

19 months agomath: Add second overload of look_at_inverse
Hudd [Wed, 18 Apr 2018 09:20:40 +0000 (12:20 +0300)]
math: Add second overload of look_at_inverse

19 months agomath: Fix typo in look_at()
Hudd [Wed, 18 Apr 2018 08:56:54 +0000 (11:56 +0300)]
math: Fix typo in look_at()

19 months agoFix missing return
Hudd [Wed, 18 Apr 2018 08:38:34 +0000 (11:38 +0300)]
Fix missing return

19 months agomath: Add look_at_inverse
Hudd [Wed, 18 Apr 2018 06:34:42 +0000 (09:34 +0300)]
math: Add look_at_inverse

19 months agogl3: Allow passing mat3 to uniforms
Hudd [Thu, 12 Apr 2018 12:11:28 +0000 (15:11 +0300)]
gl3: Allow passing mat3 to uniforms

19 months agocontainers: Convert queue to use circular_iterator
Hudd [Sat, 14 Apr 2018 08:25:17 +0000 (11:25 +0300)]
containers: Convert queue to use circular_iterator

Part of the series introducing circular_buffer.

(Forgot to commit 177 commits ago)

19 months agomath: Remove <iostream> from angle.h
Hudd [Sat, 7 Apr 2018 12:46:54 +0000 (15:46 +0300)]
math: Remove <iostream> from angle.h

19 months agomath: Update angle to C++17
Hudd [Sat, 7 Apr 2018 11:35:54 +0000 (14:35 +0300)]
math: Update angle to C++17

19 months agomath: Disambiguate different versions of look_at
Hudd [Fri, 6 Apr 2018 22:45:43 +0000 (01:45 +0300)]
math: Disambiguate different versions of look_at

19 months agomath: Add look_at function
Hudd [Fri, 6 Apr 2018 22:19:51 +0000 (01:19 +0300)]
math: Add look_at function

19 months agomath: Rename polar.h -> orientaion.h
Hudd [Fri, 6 Apr 2018 21:53:32 +0000 (00:53 +0300)]
math: Rename polar.h -> orientaion.h

19 months agomath: Add vector cross-product tests
Hudd [Fri, 6 Apr 2018 19:29:22 +0000 (22:29 +0300)]
math: Add vector cross-product tests

19 months agographics: Fix include path
Hudd [Fri, 6 Apr 2018 19:28:34 +0000 (22:28 +0300)]
graphics: Fix include path

19 months agomath: Fix vector.normalize()
Hudd [Fri, 6 Apr 2018 19:28:19 +0000 (22:28 +0300)]
math: Fix vector.normalize()

19 months agomath: Remove static qualifier from matrix functions
Hudd [Fri, 6 Apr 2018 19:27:21 +0000 (22:27 +0300)]
math: Remove static qualifier from matrix functions

These were static members of matrix_ops class, and looks like I forgot
to remove the qualifier when I moved them into namespacec.

19 months agomath: Add expand_matrix
Hudd [Fri, 6 Apr 2018 19:26:39 +0000 (22:26 +0300)]
math: Add expand_matrix

19 months agomath: Add [[nodiscard]] to transpose/inverse
Hudd [Fri, 6 Apr 2018 19:24:15 +0000 (22:24 +0300)]
math: Add [[nodiscard]] to transpose/inverse

Forgetting that transpose() has value seantics has bitten me several
times. It is harder to forget how inverse() works, but I it is possible.

19 months agomath: Add spherical_to_cartesian
Hudd [Thu, 5 Apr 2018 16:20:48 +0000 (19:20 +0300)]
math: Add spherical_to_cartesian

Convert spherical coordiantes into cartesian coordinates.
This is intended to be used in orbit camera implementation (i.e. one
that is used in most of model editors).

19 months agoMerge remote-tracking branch 'origin/gl3-wip'
Hedede [Thu, 22 Mar 2018 09:01:09 +0000 (12:01 +0300)]
Merge remote-tracking branch 'origin/gl3-wip'

19 months agogl/utility: Add load_program() func
Hudd [Thu, 22 Mar 2018 08:58:22 +0000 (11:58 +0300)]
gl/utility: Add load_program() func

19 months agogl: Move header shader_file -> program_loader
Hudd [Thu, 22 Mar 2018 08:56:07 +0000 (11:56 +0300)]
gl: Move header shader_file -> program_loader

19 months agoUpdate logger library
Hedede [Wed, 21 Mar 2018 05:02:16 +0000 (08:02 +0300)]
Update logger library

19 months agoMerge branch 'gl3-wip' of ~git/awlib
Hedede [Wed, 21 Mar 2018 03:45:56 +0000 (06:45 +0300)]
Merge branch 'gl3-wip' of ~git/awlib

19 months agogl: Add program_manager
Hudd [Wed, 21 Mar 2018 03:34:10 +0000 (06:34 +0300)]
gl: Add program_manager

20 months agomath: Extend rotation-matrix test
Hudd [Mon, 19 Feb 2018 08:49:59 +0000 (11:49 +0300)]
math: Extend rotation-matrix test

20 months agoranges: Add forward() in zip constructor
Hudd [Mon, 19 Feb 2018 05:56:14 +0000 (08:56 +0300)]
ranges: Add forward() in zip constructor

This is necessary in this case, because otherwise argument becomes an
lvalue and cannot bind to rvalue-reference.

20 months agoMove forward.h to utility
Hudd [Mon, 19 Feb 2018 05:38:28 +0000 (08:38 +0300)]
Move forward.h to utility

21 months agomath: Update matrix3 test
Hudd [Tue, 13 Feb 2018 08:16:26 +0000 (11:16 +0300)]
math: Update matrix3 test

21 months agomath: Add deduction guide for vector
Hudd [Tue, 13 Feb 2018 08:15:56 +0000 (11:15 +0300)]
math: Add deduction guide for vector

21 months agoMerge branch 'gl3-wip' into gl3-merge
Hudd [Tue, 13 Feb 2018 07:51:55 +0000 (10:51 +0300)]
Merge branch 'gl3-wip' into gl3-merge

21 months agotest: Remove `tests` directory
Hudd [Tue, 13 Feb 2018 07:07:58 +0000 (10:07 +0300)]
test: Remove `tests` directory

It was deprecated for a long time, but I had beeb too lazy to properly
rewrite test that were left there.

21 months agomath: Add test for matrix3 rotation
Hudd [Tue, 13 Feb 2018 07:06:56 +0000 (10:06 +0300)]
math: Add test for matrix3 rotation

21 months agoranges: Add `inline` to char_range
Hudd [Sun, 11 Feb 2018 09:38:25 +0000 (12:38 +0300)]
ranges: Add `inline` to char_range

21 months agocontainer: Fix typo in circular_buffer test
Hudd [Sun, 11 Feb 2018 09:38:07 +0000 (12:38 +0300)]
container: Fix typo in circular_buffer test

21 months agoUpdate readme
Hudd [Sat, 10 Feb 2018 15:17:25 +0000 (18:17 +0300)]
Update readme

It was beyond out-of-date. AWLIB hasn't been a part of AWRTS repository
for quite some time.
It is still a stub, but at least it gives better picture of what this
is.

21 months agotypes: Add circular_buffer
Hudd [Fri, 9 Feb 2018 22:20:29 +0000 (01:20 +0300)]
types: Add circular_buffer

A fixed-size buffer that overwrites itself (FIFO). This is useful for
various purposes, for example, for a fixed-size log, which holds last N
messages.

21 months agobuild: Make dependency paths absolute
Hudd [Wed, 7 Feb 2018 18:45:09 +0000 (21:45 +0300)]
build: Make dependency paths absolute

21 months agoMerge remote branch 'origin/master' into gl3-wip
Hudd [Wed, 7 Feb 2018 18:42:00 +0000 (21:42 +0300)]
Merge remote branch 'origin/master' into gl3-wip

Conflicts:
include/aw/io/mmap_file.h

21 months agogl/test: Add little explanation to camera_controller
Hudd [Wed, 7 Feb 2018 18:30:44 +0000 (21:30 +0300)]
gl/test: Add little explanation to camera_controller

21 months agographics/test: Add logger
Hudd [Fri, 10 Nov 2017 19:15:13 +0000 (22:15 +0300)]
graphics/test: Add logger

21 months agopng: Reorganize loader
Hudd [Fri, 10 Nov 2017 19:12:16 +0000 (22:12 +0300)]
png: Reorganize loader

21 months agopng: Fix crashes and heap corruption
Hudd [Fri, 10 Nov 2017 19:09:58 +0000 (22:09 +0300)]
png: Fix crashes and heap corruption

png_row_bytes() was called before png_read_update_info(), thus returning
old (before transformations) value.

21 months agoutility/ranges: C++17-ify ipairs
Hudd [Fri, 10 Nov 2017 19:03:35 +0000 (22:03 +0300)]
utility/ranges: C++17-ify ipairs

21 months agoutility/ranges: C++17-ify zip
Hudd [Fri, 10 Nov 2017 07:23:10 +0000 (10:23 +0300)]
utility/ranges: C++17-ify zip

- Make zip_iterator::iters private
- Make use of class argument deduction to get rid of index_sequence.

21 months agoutility/ranges: Replace pairs_adapter with zip
Hudd [Fri, 10 Nov 2017 07:17:35 +0000 (10:17 +0300)]
utility/ranges: Replace pairs_adapter with zip

21 months agoutility/ranges: Make zip constexpr
Hudd [Fri, 10 Nov 2017 07:16:46 +0000 (10:16 +0300)]
utility/ranges: Make zip constexpr

21 months agoutility/ranges: Make paired() constexpr
Hudd [Fri, 10 Nov 2017 06:36:09 +0000 (09:36 +0300)]
utility/ranges: Make paired() constexpr

21 months agoio: Misc fixes
Hudd [Sun, 3 Sep 2017 15:12:51 +0000 (18:12 +0300)]
io: Misc fixes

21 months agoio: Optimize read_until
Hudd [Thu, 27 Jul 2017 00:34:49 +0000 (03:34 +0300)]
io: Optimize read_until

I compared it with std::getline, and it turned out 3 times slower, most
of the time being put into std::string::push_back
I rewrote it with std::find; that made it 2 times faster, but still
slower than std::getline.
Finally, I replaced std::find with memchr, and now it is faster than
std::getline

21 months agotypes: Use std::apply for tuples
Hudd [Sun, 23 Jul 2017 08:23:26 +0000 (11:23 +0300)]
types: Use std::apply for tuples

I've also added for_each (I think there's no equivalent in std?) for
cases when I want to apply *existing* thing to each member of a tuple

21 months agoutility/ranges: Add zip
Hudd [Sun, 16 Jul 2017 09:56:22 +0000 (12:56 +0300)]
utility/ranges: Add zip

Similar to zip in function languages. I've written it a while ago, but
it required C++17 features to compile.

21 months agoutility: Update functional tests
Hudd [Fri, 30 Jun 2017 21:58:20 +0000 (00:58 +0300)]
utility: Update functional tests

21 months agoutility: Move false/true_func template params inside
Hudd [Fri, 30 Jun 2017 21:51:30 +0000 (00:51 +0300)]
utility: Move false/true_func template params inside

I think it is a lot better when template parameters don't have to be
specified. It does lose some use-cases (for example, when only *one*
overload is needed, but haven't seen such use-cases yet)

21 months agoutility: Remove stray semicolon
Hudd [Fri, 30 Jun 2017 21:48:31 +0000 (00:48 +0300)]
utility: Remove stray semicolon

21 months agoutility: Add function_wrapper
Hudd [Fri, 30 Jun 2017 21:48:18 +0000 (00:48 +0300)]
utility: Add function_wrapper

Inspired by https://dev.krzaq.cc/post/you-dont-need-a-stateful-deleter-in-your-unique_ptr-usually/
Make a functor auto of function pointer (or pointer-to-member function,
or...)

21 months agotypes: Add tmpflag
Hudd [Tue, 6 Feb 2018 07:47:01 +0000 (10:47 +0300)]
types: Add tmpflag

21 months agothread: Fix typo in spin_lock
Hudd [Tue, 16 Jan 2018 23:49:07 +0000 (02:49 +0300)]
thread: Fix typo in spin_lock

21 months agosound: Fix export declarations
Hudd [Thu, 1 Feb 2018 10:24:24 +0000 (13:24 +0300)]
sound: Fix export declarations

21 months agoconfig: Add AW_STATIC_BUILD option
Hudd [Thu, 1 Feb 2018 10:19:06 +0000 (13:19 +0300)]
config: Add AW_STATIC_BUILD option

+ A little simplification

21 months agofileformat/wav: Correct mistake in comments
Hudd [Wed, 31 Jan 2018 19:40:05 +0000 (22:40 +0300)]
fileformat/wav: Correct mistake in comments

Accodding to:
* http://freesoft.org/CIE/RFC/1890/10.htm
* https://wiki.multimedia.cx/index.php/Microsoft_IMA_ADPCMA
Initial index is 1 byte in size, not 2. The second byte is reserved.

21 months agofileformat/wav: Simplify the code a little bit
Hudd [Wed, 31 Jan 2018 19:30:49 +0000 (22:30 +0300)]
fileformat/wav: Simplify the code a little bit

I've moved the common code into a separate func

21 months agofileformat/wav: Fix skip bug
Hudd [Wed, 31 Jan 2018 19:29:16 +0000 (22:29 +0300)]
fileformat/wav: Fix skip bug

Somehow I didn't encounter this problem while testing, but immediately
got an FPE (division by zero due to wav not being loaded) after I
commited the thing

21 months agofileformat/wav: Add support for IMA ADPCM
Hudd [Wed, 31 Jan 2018 18:42:17 +0000 (21:42 +0300)]
fileformat/wav: Add support for IMA ADPCM

This also comes with a big refactor.

- support for IMA ADPCM, but no decoding
- added helper classes for each chunk
- some public helper functions

(I shpuld've split this into multiple commits, but I'm too lazy)

21 months agoMake all operator bool()s explicit
Hudd [Mon, 22 Jan 2018 16:29:37 +0000 (19:29 +0300)]
Make all operator bool()s explicit

TIL if( val ) works,
where val is a type with explicit operator bool()

22 months agoio/win32: Cleanup error_codes
Hudd [Sun, 7 Jan 2018 14:21:20 +0000 (17:21 +0300)]
io/win32: Cleanup error_codes

- Removed temporary 'look-at' comment
- Fixed whitespace (editing on windows is inconvenient as always...)

22 months agoio: Fix missing semicolon
Hudd [Sun, 7 Jan 2018 00:17:53 +0000 (03:17 +0300)]
io: Fix missing semicolon