WebGL: add LightManager getter methods to fix #1599.

This commit is contained in:
Philip Rideout
2019-09-06 08:54:47 -07:00
parent 7a819a60ae
commit 7393d5d98c
2 changed files with 74 additions and 1 deletions

View File

@@ -144,7 +144,33 @@ export class LightManager$Builder {
}
export class LightManager {
public hasComponent(entity: Entity): boolean;
public getInstance(entity: Entity): LightManager$Instance;
public static Builder(ltype: LightManager$Type): LightManager$Builder;
public getType(instance: LightManager$Instance): LightManager$Type;
public isDirectional(instance: LightManager$Instance): boolean;
public isPointLight(instance: LightManager$Instance): boolean;
public isSpotLight(instance: LightManager$Instance): boolean;
public setPosition(instance: LightManager$Instance, value: float3): void;
public getPosition(instance: LightManager$Instance): float3;
public setDirection(instance: LightManager$Instance, value: float3): void;
public getDirection(instance: LightManager$Instance): float3;
public setColor(instance: LightManager$Instance, value: float3): void;
public getColor(instance: LightManager$Instance): float3;
public setIntensity(instance: LightManager$Instance, intensity: number): void;
public setIntensityEnergy(instance: LightManager$Instance, watts: number, efficiency: number): void;
public getIntensity(instance: LightManager$Instance): number;
public setFalloff(instance: LightManager$Instance, radius: number): void;
public getFalloff(instance: LightManager$Instance: number);
public setSpotLightCone(instance: LightManager$Instance, inner: number, outer: number): void;
public setSunAngularRadius(instance: LightManager$Instance, angularRadius: number): void;
public getSunAngularRadius(instance: LightManager$Instance): number;
public setSunHaloSize(instance: LightManager$Instance, haloSize: number): void;
public getSunHaloSize(instance: LightManager$Instance): number;
public setSunHaloFalloff(instance: LightManager$Instance, haloFalloff: number): void;
public getSunHaloFalloff(instance: LightManager$Instance): number;
public setShadowCaster(instance: LightManager$Instance, shadowCaster: boolean): number;
public isShadowCaster(instance: LightManager$Instance): boolean;
}
export interface RenderableManager$Bone {

View File

@@ -821,8 +821,55 @@ class_<LightBuilder>("LightManager$Builder")
(LightBuilder* builder, float value), { return &builder->sunHaloFalloff(value); });
class_<LightManager>("LightManager")
.function("hasComponent", &LightManager::hasComponent)
/// getInstance ::method:: Gets an instance of the light component for an entity.
/// entity ::argument:: an [Entity]
/// ::retval:: a light source component
.function("getInstance", &LightManager::getInstance)
.class_function("Builder", (LightBuilder (*)(LightManager::Type)) [] (LightManager::Type lt) {
return LightBuilder(lt); });
return LightBuilder(lt); })
.function("getType", &LightManager::getType)
.function("isDirectional", &LightManager::isDirectional)
.function("isPointLight", &LightManager::isPointLight)
.function("isSpotLight", &LightManager::isSpotLight)
.function("setPosition", &LightManager::setPosition)
.function("getPosition", &LightManager::getPosition)
.function("setDirection", &LightManager::setDirection)
.function("getDirection", &LightManager::getDirection)
.function("setColor", &LightManager::setColor)
.function("getColor", &LightManager::getColor)
.function("setIntensity", EMBIND_LAMBDA(void, (LightManager* self,
LightManager::Instance instance, float intensity), {
self->setIntensity(instance, intensity);
}), allow_raw_pointers())
.function("setIntensityEnergy", EMBIND_LAMBDA(void, (LightManager* self,
LightManager::Instance instance, float watts, float efficiency), {
self->setIntensity(instance, watts, efficiency);
}), allow_raw_pointers())
.function("getIntensity", &LightManager::getIntensity)
.function("setFalloff", &LightManager::setFalloff)
.function("getFalloff", &LightManager::getFalloff)
.function("setSpotLightCone", &LightManager::setSpotLightCone)
.function("setSunAngularRadius", &LightManager::setSunAngularRadius)
.function("getSunAngularRadius", &LightManager::getSunAngularRadius)
.function("setSunHaloSize", &LightManager::setSunHaloSize)
.function("getSunHaloSize", &LightManager::getSunHaloSize)
.function("setSunHaloFalloff", &LightManager::setSunHaloFalloff)
.function("getSunHaloFalloff", &LightManager::getSunHaloFalloff)
.function("setShadowCaster", &LightManager::setShadowCaster)
.function("isShadowCaster", &LightManager::isShadowCaster)
;
/// LightManager$Instance ::class:: Component instance returned by [LightManager]
/// Be sure to call the instance's `delete` method when you're done with it.
class_<LightManager::Instance>("LightManager$Instance");
/// delete ::method:: Frees an instance obtained via `getInstance`
class_<VertexBuilder>("VertexBuffer$Builder")
.function("_build", EMBIND_LAMBDA(VertexBuffer*, (VertexBuilder* builder, Engine* engine), {