MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / lightSources

Method lightSources

source/game/StarObject.cpp:272–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272List<LightSource> Object::lightSources() const {
273 List<LightSource> lights;
274 lights.appendAll(m_networkedAnimator->lightSources(position() + m_animationPosition));
275
276 auto orientation = currentOrientation();
277 if (!m_lightSourceColor.get().isClear() && orientation) {
278 Color color = m_lightSourceColor.get();
279 if (m_lightFlickering)
280 color.setValue(clamp(color.value() * m_lightFlickering->value(SinWeightOperator<float>()), 0.0f, 1.0f));
281
282 LightSource lightSource;
283 lightSource.position = position() + centerOfTile(orientation->lightPosition);
284 lightSource.color = color.toRgbF();
285 lightSource.type = m_config->lightType;
286 lightSource.pointBeam = m_config->pointBeam;
287 lightSource.beamAngle = orientation->beamAngle;
288 lightSource.beamAmbience = m_config->beamAmbience;
289
290 lights.append(lightSource);
291 }
292
293 return lights;
294}
295
296Vec2F Object::position() const {
297 return Vec2F(m_xTilePosition.get(), m_yTilePosition.get());

Callers 1

renderLightSourcesMethod · 0.45

Calls 9

clampFunction · 0.85
centerOfTileFunction · 0.85
appendAllMethod · 0.80
isClearMethod · 0.80
toRgbFMethod · 0.80
getMethod · 0.45
setValueMethod · 0.45
valueMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected