1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "ISPCDeviceObject.h"
#include "common/FeatureFlagsEnum.h"
#include "common/ObjectFactory.h"
namespace ispc {
struct Light;
struct Instance;
} // namespace ispc
namespace ospray {
//! Base class for Light objects
struct OSPRAY_SDK_INTERFACE Light
: public ISPCDeviceObject,
public ObjectFactory<Light, api::ISPCDevice &>
{
Light(api::ISPCDevice &device, const FeatureFlagsOther ffo);
virtual ~Light() override = default;
virtual uint32_t getShCount() const;
virtual ispc::Light *createSh(
uint32_t index, const ispc::Instance *instance = nullptr) const = 0;
virtual void commit() override;
virtual std::string toString() const override;
bool visible{true};
vec3f coloredIntensity{1.0f, 1.0f, 1.0f};
OSPIntensityQuantity intensityQuantity = OSP_INTENSITY_QUANTITY_UNKNOWN;
FeatureFlags getFeatureFlags() const;
protected:
FeatureFlagsOther featureFlags;
void queryIntensityQuantityType(const OSPIntensityQuantity &defaultIQ);
};
OSPTYPEFOR_SPECIALIZATION(Light *, OSP_LIGHT);
// Inlined definitions /////////////////////////////////////////////////////////
inline uint32_t Light::getShCount() const
{
return 1;
}
inline FeatureFlags Light::getFeatureFlags() const
{
FeatureFlags ff;
ff.other = featureFlags;
return ff;
}
} // namespace ospray
|