Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asset loading #13

Merged
merged 76 commits into from
Mar 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
cc3eb54
create engine + createRenderer
hannojg Feb 23, 2024
0f7de42
format cpp
hannojg Feb 23, 2024
87a2ebb
create camera
hannojg Feb 23, 2024
7562bf3
scene + camera + view scaffolding
hannojg Feb 23, 2024
8064705
wip: asset loading
hannojg Feb 23, 2024
84ddaf3
wip: create default light + add entity to scene
hannojg Feb 23, 2024
1f35415
wip
hannojg Feb 23, 2024
7588a0d
use getter camera
hannojg Feb 23, 2024
4be6e4c
Merge branch 'main' of github.com:margelo/react-native-filament into …
hannojg Feb 23, 2024
6e3b6eb
using new reference heuristics
hannojg Feb 23, 2024
6794753
wip: adding missing types
hannojg Feb 23, 2024
2c109ac
setup swap chain
hannojg Feb 23, 2024
88b8a4c
cleanup
hannojg Feb 23, 2024
7b0ca1a
implemented renderer methods
hannojg Feb 23, 2024
628084c
cleanup
hannojg Feb 23, 2024
639249b
implemented camera manipulator
hannojg Feb 23, 2024
7dbbebf
safe guard code + make internal private
hannojg Feb 24, 2024
2026812
cleanup listener
hannojg Feb 26, 2024
df1028d
wip: FilamentBuffer
hannojg Feb 26, 2024
ffabde0
wip: example assets
hannojg Feb 26, 2024
d9fd876
fix reading bytes broken
hannojg Feb 26, 2024
2306932
load asset resources
hannojg Feb 26, 2024
6c08d06
first render output of the pengu
hannojg Feb 26, 2024
85884ac
remove black background
hannojg Feb 26, 2024
5151a2c
wip: rendering indirect light
hannojg Feb 26, 2024
23ad358
restructure, create everything in the EngineWrapper
hannojg Feb 27, 2024
f1118e0
new render implementation
hannojg Feb 27, 2024
5ff5f8c
cleanup
hannojg Feb 27, 2024
73ef9f9
remove choreographer listener
hannojg Feb 27, 2024
a62bb78
export the types
hannojg Feb 27, 2024
ddd286a
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 27, 2024
6aa20e9
updating code to new render engine
hannojg Feb 27, 2024
c15754d
change loadModel -> getAssetByteBuffer
hannojg Feb 27, 2024
83288a8
linking assets
hannojg Feb 27, 2024
29eddd5
fix ios
hannojg Feb 27, 2024
daba148
wip: populateScene?
hannojg Feb 27, 2024
a3a82b6
wip: try with animator
hannojg Feb 27, 2024
ede8005
remove animator
hannojg Feb 27, 2024
ebf6520
fix: android iOS show the same output - almost there
hannojg Feb 27, 2024
3f6c51f
there is a penguin looking at me
hannojg Feb 27, 2024
dbfc2f2
Revert "remove animator"
hannojg Feb 27, 2024
949656a
fix: Disable source builds for iOS
mrousavy Feb 27, 2024
3bd1f07
Remove `filament` source lib from `ios`
mrousavy Feb 27, 2024
18d9ccd
return in nano seconds to match android
hannojg Feb 27, 2024
c72e4a1
Update FilamentView.java
mrousavy Feb 27, 2024
13c337c
Merge branch 'main' of github.com:margelo/react-native-filament into …
hannojg Feb 27, 2024
30c82ab
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 27, 2024
05829a4
check-all
hannojg Feb 27, 2024
438fe18
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 27, 2024
4f31f90
Update package/cpp/core/EngineWrapper.cpp
hannojg Feb 27, 2024
fede57d
Update package/cpp/core/RendererWrapper.cpp
hannojg Feb 27, 2024
363c423
Update package/cpp/core/RendererWrapper.cpp
hannojg Feb 27, 2024
e2f46d6
Update package/cpp/core/RendererWrapper.cpp
hannojg Feb 27, 2024
0b02994
workaround bad_weak_ptr exception
hannojg Feb 28, 2024
826ba3d
comment manipulator
hannojg Feb 28, 2024
9ca913a
remove todo, add comment
hannojg Feb 28, 2024
b9a40c8
remove empty decl
hannojg Feb 28, 2024
61fa84e
Update package/cpp/core/EngineWrapper.cpp
hannojg Feb 28, 2024
47b637b
clean
hannojg Feb 28, 2024
4c599dd
name values
hannojg Feb 28, 2024
1bad969
remove unnecessary check
hannojg Feb 28, 2024
07ca08e
remove unnecessary check
hannojg Feb 28, 2024
5dbb1be
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 28, 2024
a68986e
update todo
hannojg Feb 28, 2024
2bd25ee
check all
hannojg Feb 28, 2024
0de95a7
fix swap chain wrapper
hannojg Feb 28, 2024
fa3ae0f
Merge branch 'feat/first-render-api' into feat/asset-loader
hannojg Feb 28, 2024
f35b6d3
cleanup camera logic
hannojg Feb 28, 2024
7d1be07
type cleanup
hannojg Feb 28, 2024
8584933
Merge branch 'main' of github.com:margelo/react-native-filament into …
hannojg Feb 29, 2024
4f8fccf
fix issues after merge
hannojg Feb 29, 2024
cddfde1
don't use pointer
hannojg Mar 5, 2024
2f72c1f
shared_ptr + using Reference
hannojg Mar 5, 2024
d953282
improve asset loading, only use one buffer
hannojg Mar 5, 2024
9dde746
feat: Add API for controlling the scene (#15)
hannojg Mar 5, 2024
886b7ce
Revert "feat: Add API for controlling the scene (#15)"
mrousavy Mar 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;

/** @noinspection JavaJniMissingFunction*/
class FilamentProxy {
Expand Down Expand Up @@ -52,13 +54,12 @@ FilamentChoreographer createChoreographer() {
@Keep
ByteBuffer getAssetByteBuffer(String assetName) throws IOException {
InputStream input = reactContext.getAssets().open(assetName);
byte[] bytes = new byte[input.available()];
input.read(bytes);
input.close();

// Allocate a *direct* ByteBuffer and put the bytes into it.
ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.length);
buffer.put(bytes);
// Create a channel from the input stream
ReadableByteChannel channel = Channels.newChannel(input);
int estimatedSize = input.available(); // This is not always accurate for the actual size
Copy link
Member

Choose a reason for hiding this comment

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

what? 😄 you cannot estimate an array size - this needs to be the exact number.

ByteBuffer buffer = ByteBuffer.allocateDirect(estimatedSize);
// Read directly into the ByteBuffer via the channel
int res = channel.read(buffer);
// Reset position to 0 to be ready for reading
buffer.flip();

Expand Down