Skip to content

Expose native constants to JavaScript - #416

Merged
syntheticmagus merged 11 commits into
BabylonJS:masterfrom
syntheticmagus:exposeNativeConstants
Sep 25, 2020
Merged

Expose native constants to JavaScript#416
syntheticmagus merged 11 commits into
BabylonJS:masterfrom
syntheticmagus:exposeNativeConstants

Conversation

@syntheticmagus

Copy link
Copy Markdown
Contributor

Changes the way constant values are communicated between Babylon.js and Babylon Native. Rather than having separate enums/arrays on both sides, Native now pushes its constants up to JavaScript by name, after which JavaScript is able to hand down the actual values native should use.

This PR depends on the Babylon.js changes in BabylonJS/Babylon.js#9023, so it will remain a draft until that PR is complete.

Comment on lines +598 to +608
InstanceValue("SAMPLER_NEAREST", Napi::Number::From(env, BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIN_POINT)), // nearest is mag = nearest and min = nearest and mip = linear
InstanceValue("SAMPLER_BILINEAR", Napi::Number::From(env, BGFX_SAMPLER_MIP_POINT)), // Bilinear is mag = linear and min = linear and mip = nearest
InstanceValue("SAMPLER_TRILINEAR", Napi::Number::From(env, 0)), // Trilinear is mag = linear and min = linear and mip = linear
InstanceValue("SAMPLER_ANISOTROPIC", Napi::Number::From(env, BGFX_SAMPLER_MIN_POINT | BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT)), // mag = nearest and min = nearest and mip = nearest
InstanceValue("SAMPLER_POINT_COMPARE", Napi::Number::From(env, BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIP_POINT)), // mag = nearest and min = linear and mip = nearest
InstanceValue("SAMPLER_TRILINEAR_COMPARE", Napi::Number::From(env, BGFX_SAMPLER_MAG_POINT)), // mag = nearest and min = linear and mip = linear
InstanceValue("SAMPLER_MINBILINEAR_MAGPOINT", Napi::Number::From(env, BGFX_SAMPLER_MAG_POINT)), // mag = nearest and min = linear and mip = none
InstanceValue("SAMPLER_MINPOINT_MAGPOINT_MIPLINEAR", Napi::Number::From(env, BGFX_SAMPLER_MAG_POINT | BGFX_SAMPLER_MIN_POINT)), // mag = nearest and min = nearest and mip = none
InstanceValue("SAMPLER_MINPOINT_MAGLINEAR_MIPPOINT", Napi::Number::From(env, BGFX_SAMPLER_MIP_POINT | BGFX_SAMPLER_MIP_POINT)), // mag = linear and min = nearest and mip = nearest
InstanceValue("SAMPLER_MINPOINT_MAGLINEAR_MIPLINEAR", Napi::Number::From(env, BGFX_SAMPLER_MIN_POINT)), // mag = linear and min = nearest and mip = linear
InstanceValue("SAMPLER_MINLINEAR_MAGPOINT_MIPPOINT", Napi::Number::From(env, 0)), // mag = linear and min = linear and mip = none

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe separate this the same as AlphaMode? The comments can go with it.

@syntheticmagus
syntheticmagus marked this pull request as ready for review September 25, 2020 00:01
Comment thread Plugins/NativeEngine/Source/NativeEngine.cpp Outdated
Minor consistency change, primarily poking the CI because it timed out.
@syntheticmagus
syntheticmagus merged commit 61b6d59 into BabylonJS:master Sep 25, 2020
@syntheticmagus
syntheticmagus deleted the exposeNativeConstants branch September 25, 2020 00:35
CedricGuillemet added a commit to CedricGuillemet/BabylonNative that referenced this pull request Sep 2, 2026
080f466590 Added bx::hasUniqueObjectRepresentation type trait. (BabylonJS#420)
671a001d3e tinystl: reset() keeps the bucket table; clear() still shrinks to 9. (BabylonJS#419)
9f874936e2 Added ability to move file into trash. (BabylonJS#418)
9e3fadf6f1 Fixed floatFlip, SIMD variable-shift masks and %g precision, and added tests. (BabylonJS#417)
26ff6d907d MinGW: Fix sal. (BabylonJS#416)
0a09590ac8 Added positional arguments to CommandLine. (BabylonJS#415)
822be40688 Scanner: Class::Identifier must not start with a digit. (BabylonJS#414)
43bfe29402 Fixed DLL search order hijacking in dlopen. (BabylonJS#413)
0b001f5f36 MSVC: Added ARM64 target. (BabylonJS#412)
056ea3486c Scanner: Cleanup. (BabylonJS#411)
9916e720fc Added scanner. (BabylonJS#410)
cd6720ce9a platform.h: detect MSVC ARM64 as 64-bit and raise 32-bit Windows minimum (BabylonJS#409)
5a2b876258 fromString: Parse hex float literals. (BabylonJS#408)
a7257985fa Added bx::isEqual for bx::StringView. (BabylonJS#407)
c98e98cde1 Fixed amalgamated build. (BabylonJS#406)
ed183eb246 Allow files with 10k+ lines to align nicely. (BabylonJS#405)

git-subtree-dir: Dependencies/bx
git-subtree-split: 080f466590c161664f2a3c5d21e05bd31cc9c8c8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants