work
This commit is contained in:
@@ -56,7 +56,7 @@ namespace polyvox {
|
||||
void loadIbl(const char* const iblUri, float intensity);
|
||||
void removeIbl();
|
||||
|
||||
SceneAsset* loadGlb(const char* const uri);
|
||||
SceneAsset* loadGlb(const char* const uri, bool unlit);
|
||||
SceneAsset* loadGltf(const char* const uri, const char* relativeResourcePath);
|
||||
void removeAsset(SceneAsset* asset);
|
||||
// removes all add assets from the current scene
|
||||
@@ -76,8 +76,9 @@ namespace polyvox {
|
||||
|
||||
Renderer* getRenderer();
|
||||
|
||||
void setBackgroundColor(const float* color);
|
||||
void setBackgroundColor(const float r, const float g, const float b, const float a);
|
||||
void setBackgroundImage(const char* resourcePath);
|
||||
void clearBackgroundImage();
|
||||
void setBackgroundImagePosition(float x, float y, bool clamp);
|
||||
void setCameraExposure(float aperture, float shutterSpeed, float sensitivity);
|
||||
void setCameraPosition(float x, float y, float z);
|
||||
@@ -125,8 +126,8 @@ namespace polyvox {
|
||||
|
||||
vector<SceneAsset*> _assets;
|
||||
|
||||
AssetLoader* _assetLoader;
|
||||
SceneAssetLoader* _sceneAssetLoader;
|
||||
SceneAssetLoader* _ubershaderAssetLoader;
|
||||
SceneAssetLoader* _unlitAssetLoader;
|
||||
NameComponentManager* _ncm;
|
||||
std::mutex mtx; // mutex to ensure thread safety when removing assets
|
||||
|
||||
@@ -148,7 +149,9 @@ namespace polyvox {
|
||||
float _cameraFocalLength = 28.0f;
|
||||
float _cameraFocusDistance = 0.0f;
|
||||
|
||||
// these flags relate to the textured quad we use for rendering unlit background images
|
||||
ColorGrading *colorGrading = nullptr;
|
||||
|
||||
// background image properties
|
||||
uint32_t _imageHeight = 0;
|
||||
uint32_t _imageWidth = 0;
|
||||
mat4f _imageScale;
|
||||
@@ -158,12 +161,12 @@ namespace polyvox {
|
||||
IndexBuffer* _imageIb = nullptr;
|
||||
Material* _imageMaterial = nullptr;
|
||||
TextureSampler _imageSampler;
|
||||
ColorGrading *colorGrading = nullptr;
|
||||
void loadKtx2Texture(string path, ResourceBuffer data);
|
||||
void loadKtxTexture(string path, ResourceBuffer data);
|
||||
void loadPngTexture(string path, ResourceBuffer data);
|
||||
void loadTextureFromPath(string path);
|
||||
|
||||
|
||||
|
||||
void _createManipulator();
|
||||
uint32_t _lastFrameTimeInNanos;
|
||||
};
|
||||
|
||||
@@ -26,11 +26,11 @@ typedef struct BoneAnimation BoneAnimation;
|
||||
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 clear_background_image(void* viewer);
|
||||
void set_background_image(void* viewer, const char* path);
|
||||
|
||||
// color is rgba
|
||||
void set_background_color(void* viewer, const float* color);
|
||||
void set_background_image_position(void* viewer, float x, float y, bool clamp);
|
||||
void set_background_color(void* viewer, const float r, const float g, const float b, const float a);
|
||||
|
||||
void load_skybox(void* viewer, const char* skyboxPath);
|
||||
void load_ibl(void* viewer, const char* iblPath, float intensity);
|
||||
void remove_skybox(void* viewer);
|
||||
@@ -38,7 +38,7 @@ void remove_ibl(void* viewer);
|
||||
int32_t add_light(void* viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
|
||||
void remove_light(void* viewer, int32_t entityId);
|
||||
void clear_lights(void* viewer);
|
||||
void* load_glb(void* viewer, const char* assetPath);
|
||||
void* load_glb(void* viewer, const char* assetPath, bool unlit);
|
||||
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);
|
||||
|
||||
@@ -20,23 +20,30 @@ namespace polyvox {
|
||||
SceneAssetLoader(
|
||||
LoadResource loadResource,
|
||||
FreeResource freeResource,
|
||||
AssetLoader* assetLoader,
|
||||
MaterialProvider* materialProvider,
|
||||
EntityManager* entityManager,
|
||||
ResourceLoader* resourceLoader,
|
||||
NameComponentManager* ncm,
|
||||
Engine* engine,
|
||||
Scene* scene);
|
||||
~SceneAssetLoader();
|
||||
SceneAsset* fromGltf(const char* uri, const char* relativeResourcePath);
|
||||
SceneAsset* fromGlb(const char* uri);
|
||||
void remove(SceneAsset* asset);
|
||||
void destroyAll();
|
||||
|
||||
private:
|
||||
LoadResource _loadResource;
|
||||
FreeResource _freeResource;
|
||||
MaterialProvider* _materialProvider;
|
||||
EntityManager* _entityManager;
|
||||
AssetLoader* _assetLoader;
|
||||
ResourceLoader* _resourceLoader;
|
||||
NameComponentManager* _ncm;
|
||||
Engine* _engine;
|
||||
Scene* _scene;
|
||||
|
||||
vector<SceneAsset*> _assets;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,8 +6,11 @@ namespace polyvox {
|
||||
const Material* _m;
|
||||
const Material* _ms[1];
|
||||
|
||||
const Engine* _engine;
|
||||
|
||||
public:
|
||||
UnlitMaterialProvider(Engine* engine) {
|
||||
_engine = engine;
|
||||
_m = Material::Builder()
|
||||
.package( UNLIT_OPAQUE_UNLIT_OPAQUE_DATA, UNLIT_OPAQUE_UNLIT_OPAQUE_SIZE)
|
||||
.build(*engine);
|
||||
@@ -35,11 +38,11 @@ namespace polyvox {
|
||||
}
|
||||
|
||||
void destroyMaterials() {
|
||||
|
||||
// TODO - do we need to do anything here?
|
||||
}
|
||||
|
||||
bool needsDummyData(filament::VertexAttribute attrib) const noexcept {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user