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

Method calculate

source/base/StarCellularLighting.cpp:122–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void CellularLightingCalculator::calculate(Image& output) {
123 Vec2S arrayMin = Vec2S(m_queryRegion.min() - m_calculationRegion.min());
124 Vec2S arrayMax = Vec2S(m_queryRegion.max() - m_calculationRegion.min());
125
126 if (m_monochrome)
127 m_lightArray.right().calculate(arrayMin[0], arrayMin[1], arrayMax[0], arrayMax[1]);
128 else
129 m_lightArray.left().calculate(arrayMin[0], arrayMin[1], arrayMax[0], arrayMax[1]);
130
131 output.reset(arrayMax[0] - arrayMin[0], arrayMax[1] - arrayMin[1], PixelFormat::RGB24);
132
133 if (m_monochrome) {
134 for (size_t x = arrayMin[0]; x < arrayMax[0]; ++x) {
135 for (size_t y = arrayMin[1]; y < arrayMax[1]; ++y) {
136 output.set24(x - arrayMin[0], y - arrayMin[1], Color::grayf(m_lightArray.right().getLight(x, y)).toRgb());
137 }
138 }
139 } else {
140 for (size_t x = arrayMin[0]; x < arrayMax[0]; ++x) {
141 for (size_t y = arrayMin[1]; y < arrayMax[1]; ++y) {
142 output.set24(x - arrayMin[0], y - arrayMin[1], Color::v3fToByte(m_lightArray.left().getLight(x, y)));
143 }
144 }
145 }
146}
147
148void CellularLightingCalculator::calculate(Lightmap& output) {
149 Vec2S arrayMin = Vec2S(m_queryRegion.min() - m_calculationRegion.min());

Callers

nothing calls this directly

Calls 14

LightmapClass · 0.85
lerpFunction · 0.85
rightMethod · 0.80
leftMethod · 0.80
set24Method · 0.80
toRgbMethod · 0.80
getLightMethod · 0.80
getFloatMethod · 0.80
xMinMethod · 0.80
yMinMethod · 0.80
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected