Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (806)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JOML 1.9.0 Pre-Release  (Read 4111 times)
0 Members and 1 Guest are viewing this topic.
Offline KaiHH

JGO Kernel


Medals: 798



« Posted 2016-10-22 18:48:40 »

The next version of JOML, which will be 1.9.0, will feature 'immutable' views/interfaces on all JOML classes.
This feature was proposed over a year ago and finally made its way into the code base.
For a detailed debate/examination of immutable views, have a look at the mentioned GitHub issue #52.

In summary, it allows an API to communicate/express the intent that a data structure, which it exposes or consumes, should/will not be modified by the consumer and/or by the provider. This is valuable in the way that a consumer of that API will know what to do when given a mutable or immutable data structure, which is most apparent when dealing with mutable instances such as Vector4f or Matrix4f, and with a client not knowing whether it can savely store a reference to this instance or (inefficiently) copy the data structure.
Likewise, it protects the API provider from unintentional modifications made by the API consumer.

Examples:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
// API provider:

private Vector4f internal;
public Vector4fc provideImmutable() {
  return internal;
}
public void consumeImmutable(Vector4fc constVector) {
  // ... constVector will not be modified ...
}

// API client:

Vector4fc providerVector = api.provideImmutable();
// providerVector will not be changed by API consumer
Vector4f clientVector = new Vector4f(...);
api.consumeImmutable(clientVector);


So, it's all about communicating and to some extent enforcing intention of how a data structure is to be used, and by whom. This in turn improves efficiency and reduces errors in programs due to unclear semantics/intentions.

The release will happen in a few days once final testing is done.

People interested in it, can already use it from oss.sonatype.org as org.joml:joml:1.9.0-SNAPSHOT or from the GitHub repository. The API is stable and also completely backwards source-compatible, meaning that porting an unmodified application from earlier JOML versions to 1.9.0 will compile without changes.
Offline KaiHH

JGO Kernel


Medals: 798



« Reply #1 - Posted 2016-10-27 12:30:12 »

The 1.9.0 release will also feature various methods to generate sampling patterns:
- Poisson on Disk
- Best Candidate on Disk
- Equi-Angle "Spiral" on Disk
- Stratified / "Center-weighted" Stratified on Square
- Uniform Disk
- Uniform Sphere

These can be helpful to generate sample locations for use in a shader.

Also new is Gaussian convolution kernel generation configurable for 2D and separable 1D kernels.

Example of Poisson (left) and Best Candidate (right) with 11,070 samples:
Offline Roquen

JGO Kernel


Medals: 518



« Reply #2 - Posted 2016-10-27 12:44:21 »

The code for the sampling all looks good.  I'd think about changing the random number generator.  

xorshiro maybe: http://xoroshiro.di.unimi.it/

A maybe problem here is it's 64-bit (thinking android).  I tossed up a few other various choices here: https://github.com/roquendm/JGO-Grabbag/tree/master/src/roquen/math/rng

EDIT: Seems I drop the ball on some of mine.  I can restructure these to be faster on average for real use patterns.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline KaiHH

JGO Kernel


Medals: 798



« Reply #3 - Posted 2016-10-27 13:08:23 »

Cool! I'd love to use a decent and first-and-foremost reproducible/deterministic, as in "people can see how it works and it produces the same results on all machines," PRNG.
Offline Roquen

JGO Kernel


Medals: 518



« Reply #4 - Posted 2016-10-27 13:13:30 »

Well if 64-bit operations are ok...xoroshiro is state-of-the-art and very fast (notice the result is ready after one addition). 
Offline KaiHH

JGO Kernel


Medals: 798



« Reply #5 - Posted 2016-10-27 13:46:02 »

Xoroshiro128+ looks decent. I am a bit unsure whether a nextInt() method would just use the 64-bit long computed by Xoroshiro and cut off the upper 32-bits.
The results however look good, so I guess, it's okay.
Offline Roquen

JGO Kernel


Medals: 518



« Reply #6 - Posted 2016-10-27 13:53:03 »

Yeah you can just drop the high bits.
Offline KaiHH

JGO Kernel


Medals: 798



« Reply #7 - Posted 2016-10-28 13:36:44 »

Now also featuring Best Candidate sampling on a sphere using Hierarchical Triangular Mesh indexing for fast 1-nearest neighbor search. This generates nice blue noise sampling patterns useful for 3D sampling in ambient occlusion or ray tracing.

Left: 128 samples
Right: 4096 samples
Black are in foreground, Grey in background
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (593 views)
2019-09-04 15:33:17

hadezbladez (5546 views)
2018-11-16 13:46:03

hadezbladez (2428 views)
2018-11-16 13:41:33

hadezbladez (5806 views)
2018-11-16 13:35:35

hadezbladez (1239 views)
2018-11-16 13:32:03

EgonOlsen (4672 views)
2018-06-10 19:43:48

EgonOlsen (5689 views)
2018-06-10 19:43:44

EgonOlsen (3208 views)
2018-06-10 19:43:20

DesertCoockie (4106 views)
2018-05-13 18:23:11

nelsongames (5135 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!