extend to support rendering to RenderTarget/OpenGL texture on Linux
11
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
Flutter plugin wrapping the Filament renderer https://github.com/google/filament.
|
||||
|
||||
Current Filament version: 1.25.0
|
||||
Current Filament version: 1.28.3
|
||||
|
||||
All:
|
||||
- clone Filament repository
|
||||
@@ -20,6 +20,15 @@ Android:
|
||||
iOS:
|
||||
- filament-v1.25.0-ios.tgz
|
||||
|
||||
Linux:
|
||||
|
||||
(Fedora 34)
|
||||
Building Filament:
|
||||
env LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/11/ CC=clang CXX=clang++ CXX_FLAGS="-v" LD_FLAGS="-v" FILAMENT_REQUIRES_CXXABI=true ./build.sh -c release
|
||||
|
||||
Running example project:
|
||||
CPLUS_INCLUDE_PATH=/usr/include/gtk-3.0/:/usr/include/pango-1.0/:/usr/include/harfbuzz:/usr/include/cairo/:/usr/include/gdk-pixbuf-2.0/:/usr/include/atk-1.0/
|
||||
|
||||
Extract and move both lib/ and include/ to ./ios
|
||||
|
||||
# Running
|
||||
|
||||
@@ -22,8 +22,14 @@ add_library(
|
||||
../ios/src/SceneAsset.cpp
|
||||
)
|
||||
|
||||
add_library(FILAMENT_SHADERS SHARED
|
||||
../ios/include/material/image_material.c
|
||||
../ios/include/material/unlitopaque.c
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
filament_interop
|
||||
FILAMENT_SHADERS
|
||||
-landroid
|
||||
-llog
|
||||
-lfilament
|
||||
@@ -55,6 +61,5 @@ target_link_libraries(
|
||||
-lsmol-v
|
||||
-luberarchive
|
||||
-lzstd
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 531 KiB |
|
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 856 KiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 193 KiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 3.7 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 500 KiB |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 614 KiB |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 457 KiB |
@@ -1,3 +1,755 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7b05a4cf63ea1c614a9385cdb902c62bad324eccbb87a6c9e3370da2b6f36f2d
|
||||
size 14565
|
||||
{
|
||||
"accessors": [
|
||||
{
|
||||
"componentType": 5123,
|
||||
"count": 24408,
|
||||
"type": "SCALAR"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 8468,
|
||||
"type": "VEC2"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 8468,
|
||||
"type": "VEC3"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 8468,
|
||||
"type": "VEC4"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 8468,
|
||||
"type": "VEC3",
|
||||
"max": [
|
||||
0.131662,
|
||||
0.137638986,
|
||||
0.10078799
|
||||
],
|
||||
"min": [
|
||||
-0.131333,
|
||||
-0.028128,
|
||||
-0.137763992
|
||||
]
|
||||
},
|
||||
{
|
||||
"componentType": 5123,
|
||||
"count": 65688,
|
||||
"type": "SCALAR"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 12552,
|
||||
"type": "VEC2"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 12552,
|
||||
"type": "VEC3"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 12552,
|
||||
"type": "VEC4"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 12552,
|
||||
"type": "VEC3",
|
||||
"max": [
|
||||
0.11722149,
|
||||
0.196387976,
|
||||
0.132422984
|
||||
],
|
||||
"min": [
|
||||
-0.11722149,
|
||||
-0.196387976,
|
||||
-0.132422984
|
||||
]
|
||||
},
|
||||
{
|
||||
"componentType": 5123,
|
||||
"count": 2208,
|
||||
"type": "SCALAR"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 436,
|
||||
"type": "VEC2"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 436,
|
||||
"type": "VEC3"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 436,
|
||||
"type": "VEC4"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 436,
|
||||
"type": "VEC3",
|
||||
"max": [
|
||||
0.09527509,
|
||||
0.114654,
|
||||
-0.08429489
|
||||
],
|
||||
"min": [
|
||||
-0.0952748954,
|
||||
0.0551489964,
|
||||
-0.14295499
|
||||
]
|
||||
},
|
||||
{
|
||||
"componentType": 5123,
|
||||
"count": 60288,
|
||||
"type": "SCALAR"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 17186,
|
||||
"type": "VEC2"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 17186,
|
||||
"type": "VEC3"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 17186,
|
||||
"type": "VEC4"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 17186,
|
||||
"type": "VEC3",
|
||||
"max": [
|
||||
0.1572095,
|
||||
0.2716865,
|
||||
0.162181988
|
||||
],
|
||||
"min": [
|
||||
-0.1572095,
|
||||
-0.2716865,
|
||||
-0.162181988
|
||||
]
|
||||
},
|
||||
{
|
||||
"componentType": 5123,
|
||||
"count": 131574,
|
||||
"type": "SCALAR"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 24148,
|
||||
"type": "VEC2"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 24148,
|
||||
"type": "VEC3"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 24148,
|
||||
"type": "VEC4"
|
||||
},
|
||||
{
|
||||
"componentType": 5126,
|
||||
"count": 24148,
|
||||
"type": "VEC3",
|
||||
"max": [
|
||||
0.1504075,
|
||||
0.328366965,
|
||||
0.173673
|
||||
],
|
||||
"min": [
|
||||
-0.1504075,
|
||||
-0.328366965,
|
||||
-0.173673
|
||||
]
|
||||
}
|
||||
],
|
||||
"asset": {
|
||||
"generator": "glTF Tools for Unity",
|
||||
"version": "2.0"
|
||||
},
|
||||
"bufferViews": [
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteOffset": 0,
|
||||
"byteLength": 59806
|
||||
},
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteOffset": 59808,
|
||||
"byteLength": 99674
|
||||
},
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteOffset": 159484,
|
||||
"byteLength": 4875
|
||||
},
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteOffset": 164360,
|
||||
"byteLength": 133545
|
||||
},
|
||||
{
|
||||
"buffer": 0,
|
||||
"byteOffset": 297908,
|
||||
"byteLength": 203914
|
||||
}
|
||||
],
|
||||
"buffers": [
|
||||
{
|
||||
"name": "FlightHelmet",
|
||||
"byteLength": 501824,
|
||||
"uri": "FlightHelmet.bin"
|
||||
}
|
||||
],
|
||||
"images": [
|
||||
{
|
||||
"name": "FlightHelmet_baseColor",
|
||||
"uri": "FlightHelmet_baseColor.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_occlusionRoughnessMetallic",
|
||||
"uri": "FlightHelmet_occlusionRoughnessMetallic.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_normal",
|
||||
"uri": "FlightHelmet_normal.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_baseColor1",
|
||||
"uri": "FlightHelmet_baseColor1.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_occlusionRoughnessMetallic1",
|
||||
"uri": "FlightHelmet_occlusionRoughnessMetallic1.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_normal1",
|
||||
"uri": "FlightHelmet_normal1.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_baseColor2",
|
||||
"uri": "FlightHelmet_baseColor2.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_occlusionRoughnessMetallic2",
|
||||
"uri": "FlightHelmet_occlusionRoughnessMetallic2.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_normal2",
|
||||
"uri": "FlightHelmet_normal2.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_baseColor3",
|
||||
"uri": "FlightHelmet_baseColor3.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_occlusionRoughnessMetallic3",
|
||||
"uri": "FlightHelmet_occlusionRoughnessMetallic3.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_normal3",
|
||||
"uri": "FlightHelmet_normal3.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_baseColor4",
|
||||
"uri": "FlightHelmet_baseColor4.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_occlusionRoughnessMetallic4",
|
||||
"uri": "FlightHelmet_occlusionRoughnessMetallic4.png"
|
||||
},
|
||||
{
|
||||
"name": "FlightHelmet_normal4",
|
||||
"uri": "FlightHelmet_normal4.png"
|
||||
}
|
||||
],
|
||||
"meshes": [
|
||||
{
|
||||
"primitives": [
|
||||
{
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 1,
|
||||
"NORMAL": 2,
|
||||
"TANGENT": 3,
|
||||
"POSITION": 4
|
||||
},
|
||||
"indices": 0,
|
||||
"material": 0,
|
||||
"mode": 4,
|
||||
"extensions": {
|
||||
"KHR_draco_mesh_compression": {
|
||||
"bufferView": 0,
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 0,
|
||||
"NORMAL": 1,
|
||||
"TANGENT": 2,
|
||||
"POSITION": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "GlassPlastic_low"
|
||||
},
|
||||
{
|
||||
"primitives": [
|
||||
{
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 6,
|
||||
"NORMAL": 7,
|
||||
"TANGENT": 8,
|
||||
"POSITION": 9
|
||||
},
|
||||
"indices": 5,
|
||||
"material": 1,
|
||||
"mode": 4,
|
||||
"extensions": {
|
||||
"KHR_draco_mesh_compression": {
|
||||
"bufferView": 1,
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 0,
|
||||
"NORMAL": 1,
|
||||
"TANGENT": 2,
|
||||
"POSITION": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "LeatherParts_low"
|
||||
},
|
||||
{
|
||||
"primitives": [
|
||||
{
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 11,
|
||||
"NORMAL": 12,
|
||||
"TANGENT": 13,
|
||||
"POSITION": 14
|
||||
},
|
||||
"indices": 10,
|
||||
"material": 2,
|
||||
"mode": 4,
|
||||
"extensions": {
|
||||
"KHR_draco_mesh_compression": {
|
||||
"bufferView": 2,
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 0,
|
||||
"NORMAL": 1,
|
||||
"TANGENT": 2,
|
||||
"POSITION": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "Lenses_low"
|
||||
},
|
||||
{
|
||||
"primitives": [
|
||||
{
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 16,
|
||||
"NORMAL": 17,
|
||||
"TANGENT": 18,
|
||||
"POSITION": 19
|
||||
},
|
||||
"indices": 15,
|
||||
"material": 3,
|
||||
"mode": 4,
|
||||
"extensions": {
|
||||
"KHR_draco_mesh_compression": {
|
||||
"bufferView": 3,
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 0,
|
||||
"NORMAL": 1,
|
||||
"TANGENT": 2,
|
||||
"POSITION": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "MetalParts_low"
|
||||
},
|
||||
{
|
||||
"primitives": [
|
||||
{
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 21,
|
||||
"NORMAL": 22,
|
||||
"TANGENT": 23,
|
||||
"POSITION": 24
|
||||
},
|
||||
"indices": 20,
|
||||
"material": 4,
|
||||
"mode": 4,
|
||||
"extensions": {
|
||||
"KHR_draco_mesh_compression": {
|
||||
"bufferView": 4,
|
||||
"attributes": {
|
||||
"TEXCOORD_0": 0,
|
||||
"NORMAL": 1,
|
||||
"TANGENT": 2,
|
||||
"POSITION": 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"name": "RubberWood_low"
|
||||
}
|
||||
],
|
||||
"materials": [
|
||||
{
|
||||
"pbrMetallicRoughness": {
|
||||
"baseColorTexture": {
|
||||
"index": 0,
|
||||
"texCoord": 0
|
||||
},
|
||||
"metallicRoughnessTexture": {
|
||||
"index": 1,
|
||||
"texCoord": 0
|
||||
},
|
||||
"baseColorFactor": [
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"metallicFactor": 1,
|
||||
"roughnessFactor": 1
|
||||
},
|
||||
"normalTexture": {
|
||||
"index": 2,
|
||||
"texCoord": 0
|
||||
},
|
||||
"occlusionTexture": {
|
||||
"index": 1,
|
||||
"texCoord": 0
|
||||
},
|
||||
"name": "GlassPlasticMat",
|
||||
"emissiveFactor": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"alphaMode": "OPAQUE",
|
||||
"doubleSided": false
|
||||
},
|
||||
{
|
||||
"pbrMetallicRoughness": {
|
||||
"baseColorTexture": {
|
||||
"index": 3,
|
||||
"texCoord": 0
|
||||
},
|
||||
"metallicRoughnessTexture": {
|
||||
"index": 4,
|
||||
"texCoord": 0
|
||||
},
|
||||
"baseColorFactor": [
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"metallicFactor": 1,
|
||||
"roughnessFactor": 1
|
||||
},
|
||||
"normalTexture": {
|
||||
"index": 5,
|
||||
"texCoord": 0
|
||||
},
|
||||
"occlusionTexture": {
|
||||
"index": 4,
|
||||
"texCoord": 0
|
||||
},
|
||||
"name": "LeatherPartsMat",
|
||||
"emissiveFactor": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"alphaMode": "OPAQUE",
|
||||
"doubleSided": false
|
||||
},
|
||||
{
|
||||
"pbrMetallicRoughness": {
|
||||
"baseColorTexture": {
|
||||
"index": 6,
|
||||
"texCoord": 0
|
||||
},
|
||||
"metallicRoughnessTexture": {
|
||||
"index": 7,
|
||||
"texCoord": 0
|
||||
},
|
||||
"baseColorFactor": [
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"metallicFactor": 1,
|
||||
"roughnessFactor": 1
|
||||
},
|
||||
"normalTexture": {
|
||||
"index": 8,
|
||||
"texCoord": 0
|
||||
},
|
||||
"occlusionTexture": {
|
||||
"index": 7,
|
||||
"texCoord": 0
|
||||
},
|
||||
"alphaMode": "BLEND",
|
||||
"name": "LensesMat",
|
||||
"emissiveFactor": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"doubleSided": false
|
||||
},
|
||||
{
|
||||
"pbrMetallicRoughness": {
|
||||
"baseColorTexture": {
|
||||
"index": 9,
|
||||
"texCoord": 0
|
||||
},
|
||||
"metallicRoughnessTexture": {
|
||||
"index": 10,
|
||||
"texCoord": 0
|
||||
},
|
||||
"baseColorFactor": [
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"metallicFactor": 1,
|
||||
"roughnessFactor": 1
|
||||
},
|
||||
"normalTexture": {
|
||||
"index": 11,
|
||||
"texCoord": 0
|
||||
},
|
||||
"occlusionTexture": {
|
||||
"index": 10,
|
||||
"texCoord": 0
|
||||
},
|
||||
"name": "MetalPartsMat",
|
||||
"emissiveFactor": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"alphaMode": "OPAQUE",
|
||||
"doubleSided": false
|
||||
},
|
||||
{
|
||||
"doubleSided": true,
|
||||
"pbrMetallicRoughness": {
|
||||
"baseColorTexture": {
|
||||
"index": 12,
|
||||
"texCoord": 0
|
||||
},
|
||||
"metallicRoughnessTexture": {
|
||||
"index": 13,
|
||||
"texCoord": 0
|
||||
},
|
||||
"baseColorFactor": [
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"metallicFactor": 1,
|
||||
"roughnessFactor": 1
|
||||
},
|
||||
"normalTexture": {
|
||||
"index": 14,
|
||||
"texCoord": 0
|
||||
},
|
||||
"occlusionTexture": {
|
||||
"index": 13,
|
||||
"texCoord": 0
|
||||
},
|
||||
"name": "RubberWoodMat",
|
||||
"emissiveFactor": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"alphaMode": "OPAQUE"
|
||||
}
|
||||
],
|
||||
"nodes": [
|
||||
{
|
||||
"mesh": 0,
|
||||
"name": "GlassPlastic_low"
|
||||
},
|
||||
{
|
||||
"mesh": 1,
|
||||
"translation": [
|
||||
0.000434499962,
|
||||
0.032592997,
|
||||
0.011676996
|
||||
],
|
||||
"name": "LeatherParts_low",
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"scale": [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"mesh": 2,
|
||||
"name": "Lenses_low"
|
||||
},
|
||||
{
|
||||
"mesh": 3,
|
||||
"translation": [
|
||||
0.0331545,
|
||||
-0.1488645,
|
||||
-0.0242879968
|
||||
],
|
||||
"name": "MetalParts_low",
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"scale": [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"mesh": 4,
|
||||
"translation": [
|
||||
-0.00190849893,
|
||||
-0.111985,
|
||||
-0.013313001
|
||||
],
|
||||
"name": "RubberWood_low",
|
||||
"rotation": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"scale": [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
],
|
||||
"rotation": [
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"name": "FlightHelmet",
|
||||
"translation": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
}
|
||||
],
|
||||
"scene": 0,
|
||||
"scenes": [
|
||||
{
|
||||
"nodes": [
|
||||
5
|
||||
]
|
||||
}
|
||||
],
|
||||
"textures": [
|
||||
{
|
||||
"source": 0
|
||||
},
|
||||
{
|
||||
"source": 1
|
||||
},
|
||||
{
|
||||
"source": 2
|
||||
},
|
||||
{
|
||||
"source": 3
|
||||
},
|
||||
{
|
||||
"source": 4
|
||||
},
|
||||
{
|
||||
"source": 5
|
||||
},
|
||||
{
|
||||
"source": 6
|
||||
},
|
||||
{
|
||||
"source": 7
|
||||
},
|
||||
{
|
||||
"source": 8
|
||||
},
|
||||
{
|
||||
"source": 9
|
||||
},
|
||||
{
|
||||
"source": 10
|
||||
},
|
||||
{
|
||||
"source": 11
|
||||
},
|
||||
{
|
||||
"source": 12
|
||||
},
|
||||
{
|
||||
"source": 13
|
||||
},
|
||||
{
|
||||
"source": 14
|
||||
}
|
||||
],
|
||||
"extensionsRequired": [
|
||||
"KHR_draco_mesh_compression"
|
||||
],
|
||||
"extensionsUsed": [
|
||||
"KHR_draco_mesh_compression"
|
||||
]
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 5.1 MiB |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 806 KiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 2.9 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 3.8 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 3.0 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 5.4 MiB |
|
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 3.5 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 3.5 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 4.4 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 5.1 MiB |
|
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 737 KiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 3.6 MiB |
|
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 4.3 MiB |
@@ -1,3 +1,16 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0bc81c711f74fdfd2ef56e34d747383444a3ab6a1ee52fe62cb5838e59b0be56
|
||||
size 545
|
||||
# Flight Helmet
|
||||
|
||||
## Screenshot
|
||||
|
||||

|
||||
|
||||
## License Information
|
||||
|
||||
Donated by Microsoft for glTF testing
|
||||
|
||||
[](http://creativecommons.org/publicdomain/zero/1.0/)
|
||||
To the extent possible under law, Microsoft has waived all copyright and related or neighboring rights to this asset.
|
||||
|
||||
Draco compression was done via Cesium tools on 27-03-2020 as follows.
|
||||
|
||||
gltf-pipeline -i FlightHelmet.gltf -o FlightHelmet.gltf -d -s --keep-unused-elements
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:84f9da89760420d519b4be28e1c9b3962416b7b87e4a1484ca56a83d57c53e3e
|
||||
size 330
|
||||
Model by LaVADraGoN at Sketchfab.
|
||||
|
||||
From an joint University Project "Dune Express" Concept-Model was created by my Partner Evil Cloud.
|
||||
|
||||
License: CC Attribution-NonCommercial
|
||||
|
||||
Draco compression was done via Cesium tools on 27-03-2020 as follows.
|
||||
|
||||
gltf-pipeline -i scene.gltf -o scene.gltf -d -s --keep-unused-elements
|
||||
|
||||
@@ -1,3 +1,836 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:36c83fcf7f31a08420f487bb7f722a4b92728e53158b76e3764f0ee304db832d
|
||||
size 20259
|
||||
{
|
||||
"asset" : {
|
||||
"generator" : "Khronos glTF Blender I/O v1.6.16",
|
||||
"version" : "2.0"
|
||||
},
|
||||
"scene" : 0,
|
||||
"scenes" : [
|
||||
{
|
||||
"name" : "Scene",
|
||||
"nodes" : [
|
||||
0,
|
||||
1,
|
||||
3
|
||||
]
|
||||
}
|
||||
],
|
||||
"nodes" : [
|
||||
{
|
||||
"mesh" : 0,
|
||||
"name" : "Cube"
|
||||
},
|
||||
{
|
||||
"mesh" : 1,
|
||||
"name" : "Cone",
|
||||
"translation" : [
|
||||
0,
|
||||
0,
|
||||
-4.3612141609191895
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Camera_Orientation"
|
||||
},
|
||||
{
|
||||
"children" : [
|
||||
2
|
||||
],
|
||||
"name" : "Camera",
|
||||
"rotation" : [
|
||||
0.5715538859367371,
|
||||
0,
|
||||
0,
|
||||
0.8205645084381104
|
||||
],
|
||||
"translation" : [
|
||||
0,
|
||||
6.8069868087768555,
|
||||
10.164137840270996
|
||||
]
|
||||
}
|
||||
],
|
||||
"animations" : [
|
||||
{
|
||||
"channels" : [
|
||||
{
|
||||
"sampler" : 0,
|
||||
"target" : {
|
||||
"node" : 0,
|
||||
"path" : "translation"
|
||||
}
|
||||
}
|
||||
],
|
||||
"name" : "FloatUp",
|
||||
"samplers" : [
|
||||
{
|
||||
"input" : 38,
|
||||
"interpolation" : "LINEAR",
|
||||
"output" : 39
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"materials" : [
|
||||
{
|
||||
"doubleSided" : true,
|
||||
"name" : "Material.001",
|
||||
"pbrMetallicRoughness" : {
|
||||
"baseColorFactor" : [
|
||||
0.800000011920929,
|
||||
0.800000011920929,
|
||||
0.800000011920929,
|
||||
1
|
||||
],
|
||||
"metallicFactor" : 0,
|
||||
"roughnessFactor" : 0.4000000059604645
|
||||
}
|
||||
}
|
||||
],
|
||||
"meshes" : [
|
||||
{
|
||||
"extras" : {
|
||||
"targetNames" : [
|
||||
"Key 1",
|
||||
"Key 2",
|
||||
"Key 3",
|
||||
"Key 4",
|
||||
"Key 5",
|
||||
"Key 6",
|
||||
"Key 7",
|
||||
"Key 8"
|
||||
]
|
||||
},
|
||||
"name" : "Cube.001",
|
||||
"primitives" : [
|
||||
{
|
||||
"attributes" : {
|
||||
"POSITION" : 0,
|
||||
"NORMAL" : 1,
|
||||
"TANGENT" : 2,
|
||||
"TEXCOORD_0" : 3
|
||||
},
|
||||
"indices" : 4,
|
||||
"material" : 0,
|
||||
"targets" : [
|
||||
{
|
||||
"POSITION" : 5,
|
||||
"NORMAL" : 6
|
||||
},
|
||||
{
|
||||
"POSITION" : 7,
|
||||
"NORMAL" : 8
|
||||
},
|
||||
{
|
||||
"POSITION" : 9,
|
||||
"NORMAL" : 10
|
||||
},
|
||||
{
|
||||
"POSITION" : 11,
|
||||
"NORMAL" : 12
|
||||
},
|
||||
{
|
||||
"POSITION" : 13,
|
||||
"NORMAL" : 14
|
||||
},
|
||||
{
|
||||
"POSITION" : 15,
|
||||
"NORMAL" : 16
|
||||
},
|
||||
{
|
||||
"POSITION" : 17,
|
||||
"NORMAL" : 18
|
||||
},
|
||||
{
|
||||
"POSITION" : 19,
|
||||
"NORMAL" : 20
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"weights" : [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
{
|
||||
"extras" : {
|
||||
"targetNames" : [
|
||||
"Key 1",
|
||||
"Key 2",
|
||||
"Key 3",
|
||||
"Key 4",
|
||||
"Key 5",
|
||||
"Key 6"
|
||||
]
|
||||
},
|
||||
"name" : "Cone",
|
||||
"primitives" : [
|
||||
{
|
||||
"attributes" : {
|
||||
"POSITION" : 21,
|
||||
"NORMAL" : 22,
|
||||
"TANGENT" : 23,
|
||||
"TEXCOORD_0" : 24
|
||||
},
|
||||
"indices" : 25,
|
||||
"targets" : [
|
||||
{
|
||||
"POSITION" : 26,
|
||||
"NORMAL" : 27
|
||||
},
|
||||
{
|
||||
"POSITION" : 28,
|
||||
"NORMAL" : 29
|
||||
},
|
||||
{
|
||||
"POSITION" : 30,
|
||||
"NORMAL" : 31
|
||||
},
|
||||
{
|
||||
"POSITION" : 32,
|
||||
"NORMAL" : 33
|
||||
},
|
||||
{
|
||||
"POSITION" : 34,
|
||||
"NORMAL" : 35
|
||||
},
|
||||
{
|
||||
"POSITION" : 36,
|
||||
"NORMAL" : 37
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"weights" : [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
],
|
||||
"accessors" : [
|
||||
{
|
||||
"bufferView" : 0,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"max" : [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"min" : [
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 1,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 2,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC4"
|
||||
},
|
||||
{
|
||||
"bufferView" : 3,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView" : 4,
|
||||
"componentType" : 5123,
|
||||
"count" : 276,
|
||||
"type" : "SCALAR"
|
||||
},
|
||||
{
|
||||
"bufferView" : 5,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"max" : [
|
||||
0.14205700159072876,
|
||||
0.36317670345306396,
|
||||
2.1620800495147705
|
||||
],
|
||||
"min" : [
|
||||
-2.325753688812256,
|
||||
-0.12704896926879883,
|
||||
-0.1493830382823944
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 6,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 7,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"max" : [
|
||||
0.14205700159072876,
|
||||
0.6298741102218628,
|
||||
0.14937379956245422
|
||||
],
|
||||
"min" : [
|
||||
-0.5040037631988525,
|
||||
-0.12704896926879883,
|
||||
-0.7224071025848389
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 8,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 9,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"max" : [
|
||||
1.1911587715148926,
|
||||
0.7055504322052002,
|
||||
0.14937379956245422
|
||||
],
|
||||
"min" : [
|
||||
-0.1420515477657318,
|
||||
-0.12704896926879883,
|
||||
-0.9040634632110596
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 10,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 11,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"max" : [
|
||||
1.0930120944976807,
|
||||
0.12705659866333008,
|
||||
0.14937379956245422
|
||||
],
|
||||
"min" : [
|
||||
-0.1420515477657318,
|
||||
-1.7105424404144287,
|
||||
-0.3054158687591553
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 12,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 13,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"max" : [
|
||||
1.0931031703948975,
|
||||
7.137829303741455,
|
||||
1.149359941482544
|
||||
],
|
||||
"min" : [
|
||||
-1.0931031703948975,
|
||||
-0.284426212310791,
|
||||
-1.149359941482544
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 14,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 15,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"max" : [
|
||||
0.7663934230804443,
|
||||
0.12705659866333008,
|
||||
0.14937379956245422
|
||||
],
|
||||
"min" : [
|
||||
-0.1420515477657318,
|
||||
-1.3416147232055664,
|
||||
-1.2583342790603638
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 16,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 17,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"max" : [
|
||||
1.0939359664916992,
|
||||
0.12705659866333008,
|
||||
0.14937379956245422
|
||||
],
|
||||
"min" : [
|
||||
-0.1420515477657318,
|
||||
-1.257744312286377,
|
||||
-1.9783165454864502
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 18,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 19,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"max" : [
|
||||
0.9689376950263977,
|
||||
0.12705659866333008,
|
||||
0.14937379956245422
|
||||
],
|
||||
"min" : [
|
||||
-0.1420515477657318,
|
||||
-1.4092154502868652,
|
||||
-1.7750303745269775
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 20,
|
||||
"componentType" : 5126,
|
||||
"count" : 276,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 21,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"max" : [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"min" : [
|
||||
-1,
|
||||
-1,
|
||||
-1
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 22,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 23,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"type" : "VEC4"
|
||||
},
|
||||
{
|
||||
"bufferView" : 24,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"type" : "VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView" : 25,
|
||||
"componentType" : 5123,
|
||||
"count" : 186,
|
||||
"type" : "SCALAR"
|
||||
},
|
||||
{
|
||||
"bufferView" : 26,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"max" : [
|
||||
0,
|
||||
0.5201449394226074,
|
||||
0
|
||||
],
|
||||
"min" : [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 27,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 28,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"max" : [
|
||||
5.200448989868164,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"min" : [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 29,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 30,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"max" : [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"min" : [
|
||||
0,
|
||||
0,
|
||||
-1.9945937395095825
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 31,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 32,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"max" : [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"min" : [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 33,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 34,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"max" : [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"min" : [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 35,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 36,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"max" : [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"min" : [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 37,
|
||||
"componentType" : 5126,
|
||||
"count" : 158,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 38,
|
||||
"componentType" : 5126,
|
||||
"count" : 60,
|
||||
"max" : [
|
||||
2.5
|
||||
],
|
||||
"min" : [
|
||||
0.041666666666666664
|
||||
],
|
||||
"type" : "SCALAR"
|
||||
},
|
||||
{
|
||||
"bufferView" : 39,
|
||||
"componentType" : 5126,
|
||||
"count" : 60,
|
||||
"type" : "VEC3"
|
||||
}
|
||||
],
|
||||
"bufferViews" : [
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 0
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 3312
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 4416,
|
||||
"byteOffset" : 6624
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 2208,
|
||||
"byteOffset" : 11040
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 552,
|
||||
"byteOffset" : 13248
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 13800
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 17112
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 20424
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 23736
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 27048
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 30360
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 33672
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 36984
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 40296
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 43608
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 46920
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 50232
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 53544
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 56856
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 60168
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 3312,
|
||||
"byteOffset" : 63480
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 66792
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 68688
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 2528,
|
||||
"byteOffset" : 70584
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1264,
|
||||
"byteOffset" : 73112
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 372,
|
||||
"byteOffset" : 74376
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 74748
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 76644
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 78540
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 80436
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 82332
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 84228
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 86124
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 88020
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 89916
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 91812
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 93708
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 1896,
|
||||
"byteOffset" : 95604
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 240,
|
||||
"byteOffset" : 97500
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 720,
|
||||
"byteOffset" : 97740
|
||||
}
|
||||
],
|
||||
"buffers" : [
|
||||
{
|
||||
"byteLength" : 98460,
|
||||
"uri" : "cube.bin"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,185 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4e5abbab543615b9933bcc271430ceb6b934811c98704700b409f3ae9c990d1e
|
||||
size 8651
|
||||
material {
|
||||
name : ubershader_gpu,
|
||||
requires : [ uv0, uv1, color ],
|
||||
shadingModel : lit,
|
||||
blending : transparent,
|
||||
depthWrite : true,
|
||||
doubleSided : true,
|
||||
flipUV : false,
|
||||
specularAmbientOcclusion : simple,
|
||||
specularAntiAliasing : true,
|
||||
clearCoatIorChange : false,
|
||||
vertexDomain: world,
|
||||
parameters : [
|
||||
|
||||
{ type : float3, name : specularFactor },
|
||||
{ type : float, name : glossinessFactor },
|
||||
|
||||
// Base Color
|
||||
{ type : int, name : baseColorIndex },
|
||||
{ type : float4, name : baseColorFactor },
|
||||
{ type : sampler2d, name : baseColorMap },
|
||||
{ type : mat3, name : baseColorUvMatrix, precision: high },
|
||||
|
||||
// Metallic-Roughness Map
|
||||
{ type : int, name : metallicRoughnessIndex },
|
||||
{ type : float, name : metallicFactor },
|
||||
{ type : float, name : roughnessFactor },
|
||||
{ type : sampler2d, name : metallicRoughnessMap },
|
||||
{ type : mat3, name : metallicRoughnessUvMatrix, precision: high },
|
||||
|
||||
// Normal Map
|
||||
{ type : int, name : normalIndex },
|
||||
{ type : float, name : normalScale },
|
||||
{ type : sampler2d, name : normalMap },
|
||||
{ type : mat3, name : normalUvMatrix, precision: high },
|
||||
|
||||
// Ambient Occlusion
|
||||
{ type : int, name : aoIndex },
|
||||
{ type : float, name : aoStrength },
|
||||
{ type : sampler2d, name : occlusionMap },
|
||||
{ type : mat3, name : occlusionUvMatrix, precision: high },
|
||||
|
||||
// Emissive Map
|
||||
{ type : int, name : emissiveIndex },
|
||||
{ type : float3, name : emissiveFactor },
|
||||
{ type : sampler2d, name : emissiveMap },
|
||||
{ type : mat3, name : emissiveUvMatrix, precision: high },
|
||||
|
||||
// Cleat coat
|
||||
{ type : float, name : clearCoatFactor },
|
||||
{ type : float, name : clearCoatRoughnessFactor },
|
||||
{ type : int, name : clearCoatIndex },
|
||||
{ type : sampler2d, name : clearCoatMap },
|
||||
{ type : mat3, name : clearCoatUvMatrix, precision: high },
|
||||
{ type : int, name : clearCoatRoughnessIndex },
|
||||
{ type : sampler2d, name : clearCoatRoughnessMap },
|
||||
{ type : mat3, name : clearCoatRoughnessUvMatrix, precision: high },
|
||||
{ type : int, name : clearCoatNormalIndex },
|
||||
{ type : sampler2d, name : clearCoatNormalMap },
|
||||
{ type : mat3, name : clearCoatNormalUvMatrix, precision: high },
|
||||
{ type : float, name : clearCoatNormalScale },
|
||||
|
||||
// Reflectance
|
||||
{ type : float, name : reflectance },
|
||||
{ type : int3, name: dimensions },
|
||||
{ type : float[255], name:"morphTargetWeights" },
|
||||
{ type: sampler2dArray, format: float, name:"morphTargets" }
|
||||
],
|
||||
}
|
||||
|
||||
fragment {
|
||||
void material(inout MaterialInputs material) {
|
||||
highp float2 uvs[2];
|
||||
uvs[0] = getUV0();
|
||||
uvs[1] = getUV1();
|
||||
|
||||
if (materialParams.normalIndex > -1) {
|
||||
highp float2 uv = uvs[materialParams.normalIndex];
|
||||
uv = (vec3(uv, 1.0) * materialParams.normalUvMatrix).xy;
|
||||
material.normal = texture(materialParams_normalMap, uv).xyz * 2.0 - 1.0;
|
||||
material.normal.xy *= materialParams.normalScale;
|
||||
}
|
||||
if (materialParams.clearCoatNormalIndex > -1) {
|
||||
highp float2 uv = uvs[materialParams.clearCoatNormalIndex];
|
||||
uv = (vec3(uv, 1.0) * materialParams.clearCoatNormalUvMatrix).xy;
|
||||
material.clearCoatNormal = texture(materialParams_clearCoatNormalMap, uv).xyz * 2.0 - 1.0;
|
||||
material.clearCoatNormal.xy *= materialParams.clearCoatNormalScale;
|
||||
}
|
||||
|
||||
prepareMaterial(material);
|
||||
material.baseColor = materialParams.baseColorFactor;
|
||||
|
||||
if (materialParams.baseColorIndex > -1) {
|
||||
highp float2 uv = uvs[materialParams.baseColorIndex];
|
||||
uv = (vec3(uv, 1.0) * materialParams.baseColorUvMatrix).xy;
|
||||
material.baseColor *= texture(materialParams_baseColorMap, uv);
|
||||
}
|
||||
|
||||
material.baseColor *= getColor();
|
||||
material.baseColor.rgb *= material.baseColor.a;
|
||||
|
||||
|
||||
material.roughness = materialParams.roughnessFactor;
|
||||
material.metallic = materialParams.metallicFactor;
|
||||
|
||||
// KHR_materials_clearcoat forbids clear coat from
|
||||
// being applied in the specular/glossiness model
|
||||
material.clearCoat = materialParams.clearCoatFactor;
|
||||
material.clearCoatRoughness = materialParams.clearCoatRoughnessFactor;
|
||||
|
||||
if (materialParams.clearCoatIndex > -1) {
|
||||
highp float2 uv = uvs[materialParams.clearCoatIndex];
|
||||
uv = (vec3(uv, 1.0) * materialParams.clearCoatUvMatrix).xy;
|
||||
material.clearCoat *= texture(materialParams_clearCoatMap, uv).r;
|
||||
}
|
||||
if (materialParams.clearCoatRoughnessIndex > -1) {
|
||||
highp float2 uv = uvs[materialParams.clearCoatRoughnessIndex];
|
||||
uv = (vec3(uv, 1.0) * materialParams.clearCoatRoughnessUvMatrix).xy;
|
||||
material.clearCoatRoughness *= texture(materialParams_clearCoatRoughnessMap, uv).g;
|
||||
}
|
||||
|
||||
material.emissive = vec4(materialParams.emissiveFactor.rgb, 0.0);
|
||||
|
||||
if (materialParams.metallicRoughnessIndex > -1) {
|
||||
highp float2 uv = uvs[materialParams.metallicRoughnessIndex];
|
||||
uv = (vec3(uv, 1.0) * materialParams.metallicRoughnessUvMatrix).xy;
|
||||
|
||||
vec4 mr = texture(materialParams_metallicRoughnessMap, uv);
|
||||
material.roughness *= mr.g;
|
||||
material.metallic *= mr.b;
|
||||
}
|
||||
|
||||
if (materialParams.aoIndex > -1) {
|
||||
highp float2 uv = uvs[materialParams.aoIndex];
|
||||
uv = (vec3(uv, 1.0) * materialParams.occlusionUvMatrix).xy;
|
||||
material.ambientOcclusion = texture(materialParams_occlusionMap, uv).r *
|
||||
materialParams.aoStrength;
|
||||
}
|
||||
if (materialParams.emissiveIndex > -1) {
|
||||
highp float2 uv = uvs[materialParams.emissiveIndex];
|
||||
uv = (vec3(uv, 1.0) * materialParams.emissiveUvMatrix).xy;
|
||||
material.emissive.rgb *= texture(materialParams_emissiveMap, uv).rgb;
|
||||
}
|
||||
}
|
||||
}
|
||||
vertex {
|
||||
vec3 getMorphTarget(int vertexIndex, int morphTargetIndex) {
|
||||
// our texture is laid out as (x,y,z) where y is 1, z is the number of morph targets, and x is the number of vertices * 2 (multiplication accounts for position + normal)
|
||||
// UV coordinates are normalized to (-1,1), so we divide the current vertex index by the total number of vertices to find the correct coordinate for this vertex
|
||||
vec3 uv = vec3(
|
||||
(float(vertexIndex) + 0.5) / float(materialParams.dimensions.x),
|
||||
0.0f,
|
||||
//(float(morphTargetIndex) + 0.5f) / float(materialParams.dimensions.z));
|
||||
float(morphTargetIndex));
|
||||
return texture(materialParams_morphTargets, uv).xyz;
|
||||
}
|
||||
|
||||
void materialVertex(inout MaterialVertexInputs material) {
|
||||
// for every morph target
|
||||
for(int morphTargetIndex = 0; morphTargetIndex < materialParams.dimensions.z; morphTargetIndex++) {
|
||||
|
||||
// get the weight to apply
|
||||
float weight = materialParams.morphTargetWeights[morphTargetIndex];
|
||||
|
||||
// get the ID of this vertex, which will be the x-offset of the position attribute in the texture sampler
|
||||
int vertexId = getVertexIndex();
|
||||
|
||||
// get the position of the target for this vertex
|
||||
vec3 morphTargetPosition = getMorphTarget(vertexId, morphTargetIndex);
|
||||
// update the world position of this vertex
|
||||
material.worldPosition.xyz += (weight * morphTargetPosition);
|
||||
|
||||
// increment the vertexID by half the size of the texture to get the x-offset of the normal (all positions stored in the first half, all normals stored in the second half)
|
||||
|
||||
vertexId += (materialParams.dimensions.x / 2);
|
||||
|
||||
// get the normal of this target for this vertex
|
||||
vec3 morphTargetNormal = getMorphTarget(vertexId, morphTargetIndex);
|
||||
material.worldNormal += (weight * morphTargetNormal);
|
||||
}
|
||||
mat4 transform = getWorldFromModelMatrix();
|
||||
material.worldPosition = mulMat4x4Float3(transform, material.worldPosition.xyz);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,9 @@ class _MyAppState extends State<MyApp> {
|
||||
case -1:
|
||||
await _filamentController.initialize();
|
||||
break;
|
||||
case -2:
|
||||
await _filamentController.render();
|
||||
break;
|
||||
case 0:
|
||||
await _filamentController
|
||||
.setBackgroundImage(
|
||||
@@ -83,7 +86,9 @@ class _MyAppState extends State<MyApp> {
|
||||
case 1:
|
||||
await _filamentController.loadSkybox(
|
||||
'assets/default_env/default_env_skybox.ktx');
|
||||
await _filamentController.loadSkybox(
|
||||
break;
|
||||
case -3:
|
||||
await _filamentController.loadIbl(
|
||||
'assets/default_env/default_env_ibl.ktx');
|
||||
break;
|
||||
case 2:
|
||||
@@ -264,6 +269,8 @@ class _MyAppState extends State<MyApp> {
|
||||
<PopupMenuEntry<int>>[
|
||||
const PopupMenuItem(
|
||||
value: -1, child: Text("initialize")),
|
||||
const PopupMenuItem(
|
||||
value: -2, child: Text("render")),
|
||||
const PopupMenuItem(
|
||||
value: 0,
|
||||
child: Text("load background image")),
|
||||
@@ -271,6 +278,10 @@ class _MyAppState extends State<MyApp> {
|
||||
value: 1,
|
||||
child: Text('load skybox'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: -3,
|
||||
child: Text('load IBL'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 2,
|
||||
child: Text('remove skybox'),
|
||||
|
||||
@@ -90,6 +90,9 @@ set_target_properties(${BINARY_NAME}
|
||||
# them to the application.
|
||||
include(flutter/generated_plugins.cmake)
|
||||
|
||||
include_directories(../../ios/include)
|
||||
|
||||
|
||||
|
||||
# === Installation ===
|
||||
# By default, "installing" just makes a relocatable bundle in the build
|
||||
|
||||
@@ -46,7 +46,8 @@ using namespace camutils;
|
||||
namespace polyvox {
|
||||
class FilamentViewer {
|
||||
public:
|
||||
FilamentViewer(void* layer, LoadResource loadResource, FreeResource freeResource);
|
||||
// FilamentViewer(void* layer, LoadResource loadResource, FreeResource freeResource);
|
||||
FilamentViewer(void* context, LoadResource loadResource, FreeResource freeResource);
|
||||
~FilamentViewer();
|
||||
|
||||
void loadSkybox(const char* const skyboxUri);
|
||||
@@ -67,8 +68,11 @@ namespace polyvox {
|
||||
|
||||
bool setFirstCamera(SceneAsset* asset);
|
||||
bool setCamera(SceneAsset* asset, const char* nodeName);
|
||||
|
||||
void createSwapChain(void* surface, uint32_t width, uint32_t height);
|
||||
void destroySwapChain();
|
||||
void createSwapChain(void* surface);
|
||||
|
||||
void createRenderTarget(uint32_t glTextureId, uint32_t width,uint32_t height);
|
||||
|
||||
Renderer* getRenderer();
|
||||
|
||||
@@ -96,8 +100,6 @@ namespace polyvox {
|
||||
void loadResources(std::string relativeResourcePath);
|
||||
void cleanup();
|
||||
|
||||
void* _layer;
|
||||
|
||||
Manipulator<float>* _manipulator = nullptr;
|
||||
math::mat4f _cameraPosition;
|
||||
math::mat4f _cameraRotation;
|
||||
@@ -113,6 +115,9 @@ namespace polyvox {
|
||||
Camera* _mainCamera;
|
||||
|
||||
Renderer* _renderer;
|
||||
RenderTarget* _rt;
|
||||
Texture* _rtColor;
|
||||
Texture* _rtDepth;
|
||||
|
||||
SwapChain* _swapChain = nullptr;
|
||||
|
||||
@@ -124,12 +129,12 @@ namespace polyvox {
|
||||
std::mutex mtx; // mutex to ensure thread safety when removing assets
|
||||
|
||||
vector<Entity> _lights;
|
||||
Texture* _skyboxTexture;
|
||||
Skybox* _skybox;
|
||||
Texture* _iblTexture;
|
||||
IndirectLight* _indirectLight;
|
||||
Texture* _skyboxTexture = nullptr;
|
||||
Skybox* _skybox = nullptr;
|
||||
Texture* _iblTexture = nullptr;
|
||||
IndirectLight* _indirectLight = nullptr;
|
||||
|
||||
MaterialProvider* _materialProvider;
|
||||
MaterialProvider* _materialProvider = nullptr;
|
||||
|
||||
gltfio::ResourceLoader* _resourceLoader = nullptr;
|
||||
gltfio::TextureProvider* _stbDecoder = nullptr;
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
typedef struct ResourceBuffer ResourceBuffer;
|
||||
|
||||
//ResourceBuffer create_resource_buffer(const void* data, const uint32_t size, const uint32_t id);
|
||||
void* filament_viewer_new(void* texture, void* loadResource, void* freeResource);
|
||||
void* filament_viewer_new(void* context, ResourceBuffer (*loadResource)(const char*), void (*freeResource)(uint32_t));
|
||||
void* filament_viewer_delete(void* viewer);
|
||||
void create_render_target(void* viewer, uint32_t textureId, uint32_t width, uint32_t height);
|
||||
void set_background_image(void* viewer, const char* path);
|
||||
void set_background_image_position(void* viewer, float x, float y, bool clamp);
|
||||
void load_skybox(void* viewer, const char* skyboxPath);
|
||||
@@ -21,6 +22,7 @@ void* load_glb(void* viewer, const char* assetPath);
|
||||
void* load_gltf(void* viewer, const char* assetPath, const char* relativePath);
|
||||
bool set_camera(void* viewer, void* asset, const char* nodeName);
|
||||
void render(void* viewer, uint64_t frameTimeInNanos);
|
||||
void create_swap_chain(void* viewer, void* surface = nullptr, uint32_t width = 0, uint32_t height = 0);
|
||||
void destroy_swap_chain(void* viewer);
|
||||
void set_frame_interval(void* viewer, float interval);
|
||||
void* get_renderer(void* viewer);
|
||||
|
||||
47
ios/include/material/UnlitMaterialProvider.hpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef UNLIT_MATERIAL_PROVIDER
|
||||
#define UNLIT_MATERIAL_PROVIDER
|
||||
namespace polyvox {
|
||||
class UnlitMaterialProvider : public MaterialProvider {
|
||||
|
||||
const Material* _m;
|
||||
const Material* _ms[1];
|
||||
|
||||
public:
|
||||
UnlitMaterialProvider(Engine* engine) {
|
||||
_m = Material::Builder()
|
||||
.package( UNLITOPAQUE_UNLIT_OPAQUE_DATA, UNLITOPAQUE_UNLIT_OPAQUE_SIZE)
|
||||
.build(*engine);
|
||||
_ms[0] = _m;
|
||||
}
|
||||
|
||||
filament::MaterialInstance* createMaterialInstance(MaterialKey* config, UvMap* uvmap,
|
||||
const char* label = "material", const char* extras = nullptr) {
|
||||
MaterialInstance* d = (MaterialInstance*)_m->getDefaultInstance();
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a weak reference to the array of cached materials.
|
||||
*/
|
||||
const filament::Material* const* getMaterials() const noexcept {
|
||||
return _ms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of cached materials.
|
||||
*/
|
||||
size_t getMaterialsCount() const noexcept {
|
||||
return (size_t)1;
|
||||
}
|
||||
|
||||
void destroyMaterials() {
|
||||
|
||||
}
|
||||
|
||||
bool needsDummyData(filament::VertexAttribute attrib) const noexcept {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -8,5 +8,5 @@ IMAGE_MATERIAL_PACKAGE:
|
||||
IMAGE_MATERIAL_IMAGE_OFFSET:
|
||||
.int 0
|
||||
IMAGE_MATERIAL_IMAGE_SIZE:
|
||||
.int 29215
|
||||
.int 14141
|
||||
|
||||
|
||||
@@ -8,5 +8,5 @@ _IMAGE_MATERIAL_PACKAGE:
|
||||
_IMAGE_MATERIAL_IMAGE_OFFSET:
|
||||
.int 0
|
||||
_IMAGE_MATERIAL_IMAGE_SIZE:
|
||||
.int 29215
|
||||
.int 14141
|
||||
|
||||
|
||||
@@ -23,17 +23,20 @@
|
||||
#include <filament/ColorGrading.h>
|
||||
#include <filament/Engine.h>
|
||||
#include <filament/IndexBuffer.h>
|
||||
#include <filament/RenderableManager.h>
|
||||
#include <filament/IndirectLight.h>
|
||||
|
||||
#include <filament/Options.h>
|
||||
|
||||
#include <filament/Renderer.h>
|
||||
#include <filament/RenderTarget.h>
|
||||
#include <filament/Scene.h>
|
||||
#include <filament/Skybox.h>
|
||||
#include <filament/TransformManager.h>
|
||||
#include <filament/VertexBuffer.h>
|
||||
#include <filament/View.h>
|
||||
#include <filament/Options.h>
|
||||
#include <filament/Viewport.h>
|
||||
|
||||
#include <filament/IndirectLight.h>
|
||||
#include <filament/RenderableManager.h>
|
||||
#include <filament/LightManager.h>
|
||||
|
||||
#include <gltfio/Animator.h>
|
||||
@@ -68,15 +71,15 @@
|
||||
|
||||
#include "Log.hpp"
|
||||
#include "SceneResources.hpp"
|
||||
#if TARGET_OS_IPHONE
|
||||
#include "material/image_material.h"
|
||||
#include "material/unlitopaque.h"
|
||||
#else
|
||||
#include "image/imagematerial.h"
|
||||
#include "shaders/unlitopaque.h"
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
#include "material/image_material.h"
|
||||
#include "material/unlitopaque.h"
|
||||
}
|
||||
|
||||
#include "FilamentViewer.hpp"
|
||||
#include "StreamBufferAdapter.hpp"
|
||||
#include "material/UnlitMaterialProvider.hpp"
|
||||
|
||||
using namespace filament;
|
||||
using namespace filament::math;
|
||||
@@ -90,73 +93,44 @@ class LightManager;
|
||||
} // namespace filament
|
||||
|
||||
namespace polyvox {
|
||||
|
||||
class UnlitMaterialProvider : public MaterialProvider {
|
||||
|
||||
const Material* _m;
|
||||
const Material* _ms[1];
|
||||
|
||||
public:
|
||||
UnlitMaterialProvider(Engine* engine) {
|
||||
_m = Material::Builder()
|
||||
.package( UNLITOPAQUE_UNLIT_OPAQUE_DATA, UNLITOPAQUE_UNLIT_OPAQUE_SIZE)
|
||||
.build(*engine);
|
||||
_ms[0] = _m;
|
||||
}
|
||||
|
||||
filament::MaterialInstance* createMaterialInstance(MaterialKey* config, UvMap* uvmap,
|
||||
const char* label = "material", const char* extras = nullptr) {
|
||||
MaterialInstance* d = (MaterialInstance*)_m->getDefaultInstance();
|
||||
return d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a weak reference to the array of cached materials.
|
||||
*/
|
||||
const filament::Material* const* getMaterials() const noexcept {
|
||||
return _ms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of cached materials.
|
||||
*/
|
||||
size_t getMaterialsCount() const noexcept {
|
||||
return (size_t)1;
|
||||
}
|
||||
|
||||
void destroyMaterials() {
|
||||
|
||||
}
|
||||
|
||||
bool needsDummyData(filament::VertexAttribute attrib) const noexcept {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const double kNearPlane = 0.05; // 5 cm
|
||||
const double kFarPlane = 1000.0; // 1 km
|
||||
const float kScaleMultiplier = 100.0f;
|
||||
// const float kScaleMultiplier = 100.0f;
|
||||
const float kAperture = 16.0f;
|
||||
const float kShutterSpeed = 1.0f / 125.0f;
|
||||
const float kSensitivity = 100.0f;
|
||||
struct Vertex {
|
||||
filament::math::float2 position;
|
||||
uint32_t color;
|
||||
};
|
||||
|
||||
FilamentViewer::FilamentViewer(void *layer, LoadResource loadResource,
|
||||
// static const Vertex TRIANGLE_VERTICES[3] = {
|
||||
// {{1, 0}, 0xffff0000u},
|
||||
// {{cos(M_PI * 2 / 3), sin(M_PI * 2 / 3)}, 0xff00ff00u},
|
||||
// {{cos(M_PI * 4 / 3), sin(M_PI * 4 / 3)}, 0xff0000ffu},
|
||||
// };
|
||||
|
||||
// static constexpr uint16_t TRIANGLE_INDICES[3] = { 0, 1, 2 };
|
||||
|
||||
|
||||
FilamentViewer::FilamentViewer(void* context, LoadResource loadResource,
|
||||
FreeResource freeResource)
|
||||
: _layer(layer), _loadResource(loadResource), _freeResource(freeResource) {
|
||||
: _loadResource(loadResource), _freeResource(freeResource) {
|
||||
Log("Creating FilamentViewer");
|
||||
#if TARGET_OS_IPHONE
|
||||
_engine = Engine::create(Engine::Backend::METAL);
|
||||
#else
|
||||
_engine = Engine::create(Engine::Backend::OPENGL);
|
||||
_engine = Engine::create(Engine::Backend::OPENGL, nullptr, context, nullptr);
|
||||
#endif
|
||||
|
||||
Log("Engine created");
|
||||
|
||||
_renderer = _engine->createRenderer();
|
||||
|
||||
float fr = 60.0f;
|
||||
_renderer->setDisplayInfo({.refreshRate = fr,
|
||||
.presentationDeadlineNanos = (uint64_t)0,
|
||||
.vsyncOffsetNanos = (uint64_t)0});
|
||||
_renderer->setDisplayInfo({.refreshRate = fr});
|
||||
|
||||
Renderer::FrameRateOptions fro;
|
||||
fro.interval = 1 / fr;
|
||||
_renderer->setFrameRateOptions(fro);
|
||||
@@ -171,6 +145,11 @@ FilamentViewer::FilamentViewer(void *layer, LoadResource loadResource,
|
||||
|
||||
Log("Main camera created");
|
||||
_view = _engine->createView();
|
||||
|
||||
decltype(_view->getBloomOptions()) opts;
|
||||
opts.enabled = true;
|
||||
_view->setBloomOptions(opts);
|
||||
|
||||
_view->setScene(_scene);
|
||||
_view->setCamera(_mainCamera);
|
||||
|
||||
@@ -184,13 +163,6 @@ FilamentViewer::FilamentViewer(void *layer, LoadResource loadResource,
|
||||
_mainCamera->setLensProjection(_cameraFocalLength, 1.0f, kNearPlane,
|
||||
kFarPlane);
|
||||
_mainCamera->setExposure(kAperture, kShutterSpeed, kSensitivity);
|
||||
#if TARGET_OS_IPHONE
|
||||
_swapChain = _engine->createSwapChain(layer, filament::backend::SWAP_CHAIN_CONFIG_APPLE_CVPIXELBUFFER);
|
||||
#else
|
||||
_swapChain = _engine->createSwapChain(layer);
|
||||
#endif
|
||||
|
||||
Log("Swapchain created");
|
||||
|
||||
View::DynamicResolutionOptions options;
|
||||
options.enabled = true;
|
||||
@@ -229,6 +201,7 @@ FilamentViewer::FilamentViewer(void *layer, LoadResource loadResource,
|
||||
_ncm,
|
||||
_engine,
|
||||
_scene);
|
||||
|
||||
}
|
||||
|
||||
static constexpr float4 sFullScreenTriangleVertices[3] = {
|
||||
@@ -280,17 +253,11 @@ void FilamentViewer::createImageRenderable() {
|
||||
return;
|
||||
|
||||
auto &em = EntityManager::get();
|
||||
#if TARGET_OS_IPHONE
|
||||
|
||||
_imageMaterial =
|
||||
Material::Builder()
|
||||
.package(IMAGE_MATERIAL_PACKAGE, IMAGE_MATERIAL_IMAGE_SIZE)
|
||||
.build(*_engine);
|
||||
#else
|
||||
_imageMaterial =
|
||||
Material::Builder()
|
||||
.package(IMAGE_MATERIAL_PACKAGE, IMAGE_MATERIAL_IMAGE_SIZE)
|
||||
.build(*_engine);
|
||||
#endif
|
||||
|
||||
_imageVb = VertexBuffer::Builder()
|
||||
.vertexCount(3)
|
||||
@@ -563,15 +530,48 @@ FilamentViewer::~FilamentViewer() {
|
||||
|
||||
Renderer *FilamentViewer::getRenderer() { return _renderer; }
|
||||
|
||||
void FilamentViewer::createSwapChain(void *surface) {
|
||||
void FilamentViewer::createSwapChain(void *surface, uint32_t width, uint32_t height) {
|
||||
#if TARGET_OS_IPHONE
|
||||
_swapChain = _engine->createSwapChain(surface, filament::backend::SWAP_CHAIN_CONFIG_APPLE_CVPIXELBUFFER);
|
||||
#else
|
||||
_swapChain = _engine->createSwapChain(surface);
|
||||
if(surface) {
|
||||
_swapChain = _engine->createSwapChain(surface);
|
||||
} else {
|
||||
_swapChain = _engine->createSwapChain(width, height, filament::backend::SWAP_CHAIN_CONFIG_TRANSPARENT | filament::backend::SWAP_CHAIN_CONFIG_READABLE);
|
||||
}
|
||||
#endif
|
||||
Log("Swapchain created.");
|
||||
}
|
||||
|
||||
void FilamentViewer::createRenderTarget(uint32_t glTextureId, uint32_t width, uint32_t height) {
|
||||
// Create filament textures and render targets (note the color buffer has the import call)
|
||||
_rtColor = filament::Texture::Builder()
|
||||
.width(width)
|
||||
.height(height)
|
||||
.levels(1)
|
||||
.usage(filament::Texture::Usage::COLOR_ATTACHMENT | filament::Texture::Usage::SAMPLEABLE)
|
||||
.format(filament::Texture::InternalFormat::RGBA8)
|
||||
.import(glTextureId)
|
||||
.build(*_engine);
|
||||
_rtDepth = filament::Texture::Builder()
|
||||
.width(width)
|
||||
.height(height)
|
||||
.levels(1)
|
||||
.usage(filament::Texture::Usage::DEPTH_ATTACHMENT)
|
||||
.format(filament::Texture::InternalFormat::DEPTH24)
|
||||
.build(*_engine);
|
||||
_rt = filament::RenderTarget::Builder()
|
||||
.texture(RenderTarget::AttachmentPoint::COLOR, _rtColor)
|
||||
.texture(RenderTarget::AttachmentPoint::DEPTH, _rtDepth)
|
||||
.build(*_engine);
|
||||
|
||||
// Make a specific viewport just for our render target
|
||||
_view->setRenderTarget(_rt);
|
||||
|
||||
Log("Set render target for glTextureId %u %u x %u", glTextureId, width, height);
|
||||
|
||||
}
|
||||
|
||||
void FilamentViewer::destroySwapChain() {
|
||||
if (_swapChain) {
|
||||
_engine->destroy(_swapChain);
|
||||
@@ -730,18 +730,22 @@ bool FilamentViewer::setCamera(SceneAsset *asset, const char *cameraName) {
|
||||
}
|
||||
|
||||
void FilamentViewer::loadSkybox(const char *const skyboxPath) {
|
||||
Log("Loading skybox from %s", skyboxPath);
|
||||
|
||||
removeSkybox();
|
||||
|
||||
if (skyboxPath) {
|
||||
ResourceBuffer skyboxBuffer = _loadResource(skyboxPath);
|
||||
|
||||
if(skyboxBuffer.size == 0) {
|
||||
Log("Error loading IBL, resource could not be loaded.");
|
||||
if(skyboxBuffer.size <= 0) {
|
||||
Log("Could not load skybox resource.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
image::Ktx1Bundle *skyboxBundle =
|
||||
new image::Ktx1Bundle(static_cast<const uint8_t *>(skyboxBuffer.data),
|
||||
static_cast<uint32_t>(skyboxBuffer.size));
|
||||
|
||||
_skyboxTexture =
|
||||
ktxreader::Ktx1Reader::createTexture(_engine, *skyboxBundle, false, [](void* userdata) {
|
||||
image::Ktx1Bundle* bundle = (image::Ktx1Bundle*) userdata;
|
||||
@@ -752,16 +756,21 @@ void FilamentViewer::loadSkybox(const char *const skyboxPath) {
|
||||
|
||||
_scene->setSkybox(_skybox);
|
||||
_freeResource(skyboxBuffer.id);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void FilamentViewer::removeSkybox() {
|
||||
Log("Removing skybox");
|
||||
if(_skybox) {
|
||||
|
||||
_engine->destroy(_skybox);
|
||||
_engine->destroy(_skyboxTexture);
|
||||
_skybox = nullptr;
|
||||
_skyboxTexture = nullptr;
|
||||
}
|
||||
}
|
||||
_scene->setSkybox(nullptr);
|
||||
}
|
||||
|
||||
@@ -835,6 +844,8 @@ void FilamentViewer::render(uint64_t frameTimeInNanos) {
|
||||
if (_renderer->beginFrame(_swapChain, frameTimeInNanos)) {
|
||||
_renderer->render(_view);
|
||||
_renderer->endFrame();
|
||||
} else {
|
||||
// skipped frame
|
||||
}
|
||||
|
||||
}
|
||||
@@ -868,7 +879,7 @@ void FilamentViewer::setCameraPosition(float x, float y, float z) {
|
||||
_manipulator = nullptr;
|
||||
}
|
||||
Camera& cam =_view->getCamera();
|
||||
auto &tm = _engine->getTransformManager();
|
||||
|
||||
_cameraPosition = math::mat4f::translation(math::float3(x,y,z));
|
||||
cam.setModelMatrix(_cameraPosition * _cameraRotation);
|
||||
}
|
||||
@@ -879,7 +890,7 @@ void FilamentViewer::setCameraRotation(float rads, float x, float y, float z) {
|
||||
_manipulator = nullptr;
|
||||
}
|
||||
Camera& cam =_view->getCamera();
|
||||
auto &tm = _engine->getTransformManager();
|
||||
|
||||
_cameraRotation = math::mat4f::rotation(rads, math::float3(x,y,z));
|
||||
cam.setModelMatrix(_cameraPosition * _cameraRotation);
|
||||
}
|
||||
@@ -971,3 +982,5 @@ void FilamentViewer::scrollEnd() {
|
||||
}
|
||||
|
||||
} // namespace polyvox
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
#ifndef _POLYVOX_FILAMENT_API_H
|
||||
#define _POLYVOX_FILAMENT_API_H
|
||||
|
||||
#include "ResourceBuffer.hpp"
|
||||
#include "FilamentViewer.hpp"
|
||||
#include "filament/LightManager.h"
|
||||
@@ -13,8 +10,13 @@ extern "C" {
|
||||
// return ResourceBuffer {data, size, id };
|
||||
// }
|
||||
|
||||
void* filament_viewer_new(void* texture, ResourceBuffer (*loadResource)(const char*), void (*freeResource)(uint32_t)) {
|
||||
return nullptr;
|
||||
void* filament_viewer_new(void* context, ResourceBuffer (*loadResource)(char const*), void (*freeResource)(unsigned int)) {
|
||||
FilamentViewer* v = new FilamentViewer(context, loadResource, freeResource);
|
||||
return (void*)v;
|
||||
}
|
||||
|
||||
void create_render_target(void* viewer, uint32_t textureId, uint32_t width, uint32_t height) {
|
||||
((FilamentViewer*)viewer)->createRenderTarget(textureId, width, height);
|
||||
}
|
||||
|
||||
void filament_viewer_delete(void* viewer) {
|
||||
@@ -43,7 +45,6 @@ extern "C" {
|
||||
void remove_skybox(void* viewer) {
|
||||
((FilamentViewer*)viewer)->removeSkybox();
|
||||
}
|
||||
|
||||
|
||||
void remove_ibl(void* viewer) {
|
||||
((FilamentViewer*)viewer)->removeIbl();
|
||||
@@ -103,6 +104,10 @@ extern "C" {
|
||||
((FilamentViewer*)viewer)->destroySwapChain();
|
||||
}
|
||||
|
||||
void create_swap_chain(void* viewer, void* surface=nullptr, uint32_t width=0, uint32_t height=0) {
|
||||
((FilamentViewer*)viewer)->createSwapChain(surface, width, height);
|
||||
}
|
||||
|
||||
void* get_renderer(void* viewer) {
|
||||
return ((FilamentViewer*)viewer)->getRenderer();
|
||||
}
|
||||
@@ -206,5 +211,3 @@ extern "C" {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -189,7 +189,6 @@ void SceneAsset::setTexture() {
|
||||
size_t mic = _asset->getInstance()->getMaterialInstanceCount();
|
||||
Log("Material instance count : %d", mic);
|
||||
|
||||
RenderableManager &rm = _engine->getRenderableManager();
|
||||
auto sampler = TextureSampler();
|
||||
inst[0]->setParameter("baseColorIndex",0);
|
||||
inst[0]->setParameter("baseColorMap",_texture,sampler);
|
||||
@@ -266,7 +265,7 @@ unique_ptr<vector<string>> SceneAsset::getTargetNames(const char *meshName) {
|
||||
// Log("Retrieving morph target names for mesh %s", meshName);
|
||||
unique_ptr<vector<string>> names = make_unique<vector<string>>();
|
||||
const Entity *entities = _asset->getEntities();
|
||||
RenderableManager &rm = _engine->getRenderableManager();
|
||||
|
||||
for (int i = 0; i < _asset->getEntityCount(); i++) {
|
||||
Entity e = entities[i];
|
||||
auto inst = _ncm->getInstance(e);
|
||||
|
||||
@@ -5,18 +5,35 @@ cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# Project-level configuration.
|
||||
set(PROJECT_NAME "polyvox_filament")
|
||||
project(${PROJECT_NAME} LANGUAGES CXX)
|
||||
project(${PROJECT_NAME})
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fPIC -Wno-unused-variable -Wno-unused-function")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wno-unused-variable")
|
||||
|
||||
# This value is used when generating builds using this plugin, so it must
|
||||
# not be changed.
|
||||
set(PLUGIN_NAME "polyvox_filament_plugin")
|
||||
|
||||
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||
|
||||
add_library(FILAMENT_SHADERS SHARED
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/include/material/image_material.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/include/material/unlitopaque.c"
|
||||
)
|
||||
|
||||
# Define the plugin library target. Its name must not be changed (see comment
|
||||
# on PLUGIN_NAME above).
|
||||
#
|
||||
# Any new source files that you add to the plugin should be added here.
|
||||
add_library(${PLUGIN_NAME} SHARED
|
||||
"polyvox_filament_plugin.cc"
|
||||
"filament_texture.cc"
|
||||
"filament_pb_texture.cc"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/SceneAssetLoader.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/SceneAsset.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FilamentViewer.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/PolyvoxFilamentApi.cpp"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/StreamBufferAdapter.cpp"
|
||||
)
|
||||
|
||||
# Apply a standard set of build settings that are configured in the
|
||||
@@ -31,13 +48,57 @@ set_target_properties(${PLUGIN_NAME} PROPERTIES
|
||||
CXX_VISIBILITY_PRESET hidden)
|
||||
target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL)
|
||||
|
||||
target_compile_features(${PLUGIN_NAME} PRIVATE cxx_std_17)
|
||||
|
||||
# Source include directories and library dependencies. Add any plugin-specific
|
||||
# dependencies here.
|
||||
target_include_directories(${PLUGIN_NAME} INTERFACE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
include_directories(../ios/src)
|
||||
include_directories(../ios/include)
|
||||
include_directories(../example/linux)
|
||||
|
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter)
|
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
|
||||
|
||||
|
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE
|
||||
FILAMENT_SHADERS
|
||||
geometry
|
||||
filament
|
||||
backend
|
||||
geometry
|
||||
filameshio
|
||||
viewer
|
||||
filamat
|
||||
utils
|
||||
filabridge
|
||||
gltfio_core
|
||||
filament-iblprefilter
|
||||
image
|
||||
camutils
|
||||
filaflat
|
||||
dracodec
|
||||
ibl
|
||||
ktxreader
|
||||
image
|
||||
imageio
|
||||
tinyexr
|
||||
stb
|
||||
EGL
|
||||
bluevk
|
||||
vkshaders
|
||||
bluegl
|
||||
uberzlib
|
||||
smol-v
|
||||
uberarchive
|
||||
meshoptimizer
|
||||
mathio
|
||||
-l:libmath.a
|
||||
geometry
|
||||
)
|
||||
|
||||
# List of absolute paths to libraries that should be bundled with the plugin.
|
||||
# This list could contain prebuilt libraries, or libraries created by an
|
||||
# external build triggered from this build file.
|
||||
|
||||
67
linux/filament_pb_texture.cc
Normal file
@@ -0,0 +1,67 @@
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <flutter_linux/fl_texture_registrar.h>
|
||||
#include <flutter_linux/fl_texture.h>
|
||||
#include <flutter_linux/fl_pixel_buffer_texture.h>
|
||||
#include <flutter_linux/fl_texture_gl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include "include/polyvox_filament/filament_pb_texture.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
G_DEFINE_TYPE(FilamentPBTexture,
|
||||
filament_pb_texture,
|
||||
fl_pixel_buffer_texture_get_type())
|
||||
|
||||
|
||||
static gboolean video_texture_copy_pixels (FlPixelBufferTexture* texture,
|
||||
const uint8_t** out_buffer,
|
||||
uint32_t* width,
|
||||
uint32_t* height,
|
||||
GError** error) {
|
||||
|
||||
auto buffer = new std::vector<uint8_t>(400*200*4);
|
||||
for (int i = 0; i < 400*200*4; i++)
|
||||
{
|
||||
if(i%4 == 1 || i % 4 == 3) {
|
||||
buffer->at(i) = (uint8_t)255;
|
||||
} else {
|
||||
buffer->at(i) = (uint8_t)0;
|
||||
}
|
||||
}
|
||||
*width = 400;
|
||||
*height = 200;
|
||||
*out_buffer = buffer->data();
|
||||
std::cout << "COPY" << std::endl;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void filament_pb_texture_dispose(GObject* object) {
|
||||
G_OBJECT_CLASS(filament_pb_texture_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
void filament_pb_texture_class_init(FilamentPBTextureClass* klass) {
|
||||
G_OBJECT_CLASS(klass)->dispose = filament_pb_texture_dispose;
|
||||
FL_PIXEL_BUFFER_TEXTURE_CLASS(klass)->copy_pixels = video_texture_copy_pixels;
|
||||
}
|
||||
|
||||
void filament_pb_texture_init(FilamentPBTexture* self) { }
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT FlTexture* create_filament_pb_texture(uint32_t width, uint32_t height, FlTextureRegistrar* registrar) {
|
||||
|
||||
auto pbTexture = FILAMENT_PB_TEXTURE(g_object_new(filament_pb_texture_get_type(), nullptr));
|
||||
|
||||
g_autoptr(FlTexture) texture = FL_TEXTURE(pbTexture);
|
||||
|
||||
if(fl_texture_registrar_register_texture(registrar, texture) == TRUE) {
|
||||
if(fl_texture_registrar_mark_texture_frame_available(registrar,
|
||||
texture) != TRUE) {
|
||||
std::cout << "FAILED" << std::endl;
|
||||
}
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
74
linux/filament_texture.cc
Normal file
@@ -0,0 +1,74 @@
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <flutter_linux/fl_texture_registrar.h>
|
||||
#include <flutter_linux/fl_texture.h>
|
||||
#include <flutter_linux/fl_texture_gl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include "include/polyvox_filament/filament_texture.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
G_DEFINE_TYPE(FilamentTextureGL,
|
||||
filament_texture_gl,
|
||||
fl_texture_gl_get_type())
|
||||
|
||||
static gboolean
|
||||
filament_texture_populate (FlTextureGL *texture,
|
||||
uint32_t *target,
|
||||
uint32_t *name,
|
||||
uint32_t *width,
|
||||
uint32_t *height,
|
||||
GError **error) {
|
||||
FilamentTextureGL *self = FILAMENT_TEXTURE_GL (texture);
|
||||
*target = GL_TEXTURE_2D;
|
||||
*name = self->texture_id;
|
||||
*width = self->width;
|
||||
*height = self->height;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void filament_texture_gl_dispose(GObject* object) {
|
||||
G_OBJECT_CLASS(filament_texture_gl_parent_class)->dispose(object);
|
||||
}
|
||||
|
||||
void filament_texture_gl_class_init(FilamentTextureGLClass* klass) {
|
||||
G_OBJECT_CLASS(klass)->dispose = filament_texture_gl_dispose;
|
||||
FL_TEXTURE_GL_CLASS(klass)->populate = filament_texture_populate;
|
||||
}
|
||||
|
||||
void filament_texture_gl_init(FilamentTextureGL* self) { }
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT FlTexture* create_filament_texture(uint32_t width, uint32_t height, FlTextureRegistrar* registrar) {
|
||||
auto textureGL = FILAMENT_TEXTURE_GL(g_object_new(filament_texture_gl_get_type(), nullptr));
|
||||
textureGL->width = width;
|
||||
textureGL->height = height;
|
||||
|
||||
g_autoptr(FlTexture) texture = FL_TEXTURE(textureGL);
|
||||
|
||||
|
||||
glGenTextures(1, &textureGL->texture_id);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, textureGL->texture_id);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA8, textureGL->width, textureGL->height, 0, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, 0);
|
||||
|
||||
if(fl_texture_registrar_register_texture(registrar, texture) == TRUE) {
|
||||
|
||||
if(fl_texture_registrar_mark_texture_frame_available(registrar,
|
||||
texture) != TRUE) {
|
||||
std::cout << "FAILED" << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
44
linux/include/polyvox_filament/filament_pb_texture.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef FILAMENT_PB_TEXTURE_H
|
||||
#define FILAMENT_PB_TEXTURE_H
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib-object.h>
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <flutter_linux/fl_texture_gl.h>
|
||||
#include <flutter_linux/fl_texture.h>
|
||||
#include <flutter_linux/fl_pixel_buffer_texture.h>
|
||||
#include <flutter_linux/fl_texture_registrar.h>
|
||||
|
||||
|
||||
#ifdef FLUTTER_PLUGIN_IMPL
|
||||
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define FLUTTER_PLUGIN_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define FILAMENT_PB_TEXTURE(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), filament_pb_texture_get_type(), \
|
||||
FilamentPBTexture))
|
||||
|
||||
struct _FilamentPBTexture {
|
||||
FlPixelBufferTexture parent_instance;
|
||||
};
|
||||
|
||||
typedef struct _FilamentPBTexture FilamentPBTexture;
|
||||
typedef struct {
|
||||
FlPixelBufferTextureClass parent_instance;
|
||||
gboolean (*copy_pixels)(FlPixelBufferTexture* texture,
|
||||
const uint8_t** buffer,
|
||||
uint32_t* width,
|
||||
uint32_t* height,
|
||||
GError** error);
|
||||
|
||||
} FilamentPBTextureClass;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT FlTexture* create_filament_pb_texture(uint32_t width, uint32_t height, FlTextureRegistrar* registrar);
|
||||
|
||||
#endif
|
||||
48
linux/include/polyvox_filament/filament_texture.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef FILAMENT_TEXTURE_H
|
||||
#define FILAMENT_TEXTURE_H
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib-object.h>
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <flutter_linux/fl_texture_gl.h>
|
||||
#include <flutter_linux/fl_texture.h>
|
||||
#include <flutter_linux/fl_texture_registrar.h>
|
||||
|
||||
|
||||
#ifdef FLUTTER_PLUGIN_IMPL
|
||||
#define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define FLUTTER_PLUGIN_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define FILAMENT_TEXTURE_GL(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), filament_texture_gl_get_type(), \
|
||||
FilamentTextureGL))
|
||||
|
||||
struct _FilamentTextureGL {
|
||||
FlTextureGL parent_instance;
|
||||
GLuint texture_id;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
};
|
||||
|
||||
typedef struct _FilamentTextureGL FilamentTextureGL;
|
||||
typedef struct {
|
||||
FlTextureGLClass parent_instance;
|
||||
gboolean (*populate)(FlTextureGL* texture,
|
||||
uint32_t* target,
|
||||
uint32_t* name,
|
||||
uint32_t* width,
|
||||
uint32_t* height,
|
||||
GError** error);
|
||||
|
||||
GLuint texture_id;
|
||||
} FilamentTextureGLClass;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
FLUTTER_PLUGIN_EXPORT FlTexture* create_filament_texture(uint32_t width, uint32_t height, FlTextureRegistrar* registrar);
|
||||
|
||||
#endif
|
||||
@@ -2,6 +2,7 @@
|
||||
#define FLUTTER_PLUGIN_POLYVOX_FILAMENT_PLUGIN_H_
|
||||
|
||||
#include <flutter_linux/flutter_linux.h>
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
3
linux/lib/libOGLCompiler.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4aaf436489ba71b8c6f5d921cad39f1c4e3104c176c374efae3a728e45d11502
|
||||
size 3940
|
||||
3
linux/lib/libOSDependent.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0327c66ed61c78233914909dcffc410fbb056faa6900d3db17d67459d3f31fa6
|
||||
size 5294
|
||||
3
linux/lib/libSPIRV-Tools-diff.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ac1387628b4d7ebd89a3121815540256f46e5aaf397c3023d0974bcc3a85506f
|
||||
size 499778
|
||||
3
linux/lib/libSPIRV-Tools-link.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a75e67e06921513fb04dc8d5aaeb6b975eab1bab0bcd02d3a0a39398c162c6ac
|
||||
size 162318
|
||||
3
linux/lib/libSPIRV-Tools-lint.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6b6bab1c7a792a4769f479ad55d0c116f8755c418ebe7d64292ccf7a6fbcb033
|
||||
size 273884
|
||||
3
linux/lib/libSPIRV-Tools-opt.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:464c750b313575d2c2c62cf1ace18eb67813a654c12e9ab809b5e9b5a02b9160
|
||||
size 12709646
|
||||
3
linux/lib/libSPIRV-Tools-reduce.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:88f1ab1b62fec378637a8608d26e39a4f9cccfad68898fe132f1e7d56c57caa7
|
||||
size 836218
|
||||
3
linux/lib/libSPIRV-Tools.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:70c565068260155b85b1b20e3fc65469475f522fa38581482f4f15e984a8a26f
|
||||
size 4047794
|
||||
3
linux/lib/libSPIRV.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2933df356c0346f58d55c0682a6a9828561a3d0a3c16119220efe20d1467e4cc
|
||||
size 1773318
|
||||
3
linux/lib/libassimp.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aa3d111b7912c2e1e23fe382dcecd19a33091800da9e27635980de264cd89efe
|
||||
size 3880496
|
||||
3
linux/lib/libbackend.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ac4abd851be9f0eed4b95000baef7fa2b0409c1df337295cf5e1ef1b7d6dbaea
|
||||
size 1690468
|
||||
3
linux/lib/libbasis_encoder.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:17bd4166018341677a88d292dd7304a3fcf8a2e7fff90efda230baac0fdf2f1d
|
||||
size 1410760
|
||||
3
linux/lib/libbasis_transcoder.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f35efb26c0143301cdee46e7362656970520f5f65d4b3c654d18b69e38cb9bc4
|
||||
size 537812
|
||||
3
linux/lib/libbenchmark.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2741667ac0e1e0e0272a80e1fc73de59bbbc39740e19fd79bd06c98a6269757e
|
||||
size 591234
|
||||
3
linux/lib/libbenchmark_main.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:22b4861b8b446fe1b1f5aa785ab09bb81d8eeae50bf5e428ac3043c08201fcf2
|
||||
size 2192
|
||||
3
linux/lib/libbluegl.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:571e356344c8cad8c87708e92dde7889516b6f6b6b8c92a75fe2d1a53104cb54
|
||||
size 1135330
|
||||
3
linux/lib/libbluevk.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bf814327734358793f6df11c88637b98b9ff9e5bd440a2dce8d9e51071c188dd
|
||||
size 175380
|
||||
3
linux/lib/libcamutils.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3d56a24728acf4b18a12230984c6657e0f87e7d06196bc5870dc9af7d1f945e1
|
||||
size 60246
|
||||
3
linux/lib/libcivetweb.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:eb778f2052cdf43e20d4c5c6b0c9caedafaaec1cd67c093a017111bb0370ae6b
|
||||
size 300552
|
||||
3
linux/lib/libdracodec.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:51072abd5dfbceece10028e281c9e03782b9b2ce26bccee0ee2df3a1f26f4529
|
||||
size 2554848
|
||||
3
linux/lib/libfilabridge.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:00631ea36f087c1bccdfc9ad093c80b337ca08819358385967ea9138603cd79e
|
||||
size 64946
|
||||
3
linux/lib/libfilaflat.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:007d156c68edfeb1d410094820acef98a5144a75b5858e0aa538af50eec3e59e
|
||||
size 43616
|
||||
3
linux/lib/libfilagui.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:34eb1d23ed8172a1f889262c9a19e4f79c95cc400d81af242ae88920f3c6fc74
|
||||
size 114036
|
||||
3
linux/lib/libfilamat.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0efa5a8a9ec3d114a9882d17e5231f24600250510743d2e25086b7973f945860
|
||||
size 29448180
|
||||
3
linux/lib/libfilamat_combined.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fdde9c8708cadcde670a376407c455b4b16c53892cbefa0d6436307c249e6eaf
|
||||
size 29448180
|
||||
3
linux/lib/libfilamat_lite.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6eb32aae2e7f732b7f22e8c169e795b8e67f67cd2469a158529353d74f56e4d5
|
||||
size 584682
|
||||
3
linux/lib/libfilament-iblprefilter.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fc5486db22a0d01f16ef6f093cc737f950a9ed90f7f880651aa88061be4bb1aa
|
||||
size 52686
|
||||
3
linux/lib/libfilament.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f77735120c66966b7dd760510b3ec541cea2116e6098099520028156bec8b6fb
|
||||
size 2634676
|
||||
3
linux/lib/libfilamentapp-resources.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:32daace64e95eab47eeedcf41316a206ea7524242da5b978e11e5c126ccb1950
|
||||
size 1017810
|
||||
3
linux/lib/libfilamentapp.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:38f04e48455161b25bb8c713713bee391ce7908f4f1881d1464585e7ad59b2d2
|
||||
size 356048
|
||||
3
linux/lib/libfilameshio.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c16ca38264d0b6e4c08680ee6038b94d7061fb9c19b4078d65ad0c764e717e2e
|
||||
size 39506
|
||||
3
linux/lib/libgeometry.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e865b838a0e09daf6f77dff65aa833fab34d1d74acec95c2f19179e624ed26ef
|
||||
size 39390
|
||||
3
linux/lib/libgetopt.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d30c6cbedc32007ec3100a1f5b683e5dd6183ef321ac953de09b9862b1e6d40d
|
||||
size 8016
|
||||
3
linux/lib/libglslang.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:de4997c7619ed8f581dc93fde892cbdb7a8a193c96f3f464a9164ce539cc876e
|
||||
size 4621260
|
||||
3
linux/lib/libgltf-demo-resources.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:696c21bc5f7c0b33f0779b508a47cffde4bbb0fd3e3e2be356fe8b0eb6567120
|
||||
size 3955646
|
||||
3
linux/lib/libgltfio.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:04b04d76363603d7500243c2f1c03c84ac564a7207bc07464499ba9dc87d6d17
|
||||
size 46224
|
||||
3
linux/lib/libgltfio_core.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:84680f658766b77a42775f10a0ad4a28acfbb4f7c42d62532ad22efa1c6b2ccf
|
||||
size 1127462
|
||||
3
linux/lib/libgtest.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4708f5c09ce031cc389ff2b2da2015c118f2e615846c4989a89900ce8b6b8547
|
||||
size 891830
|
||||
3
linux/lib/libibl-lite.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bb24571755f31e2730a42ba68c9f4b5d32ef7cacb007716cd98a08836e4ca1d5
|
||||
size 399434
|
||||
3
linux/lib/libibl.a
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:78f779af48d685f2a62286e6677a099ee5901c317cbcb26fe539ced28d71b70b
|
||||
size 491202
|
||||