// store settings for last selected light void LightSettings::saveSettingsToLight_() { if (current_light_ == -1 || current_light_ >= (Index)lights_.size()) { return; } LightSource& light = lights_[current_light_]; light.setColor(getColor(color_sample)); try { Vector3 pos = getPosition_(); Vector3 dir = getDirection_(); Vector3 att = getAttenuation_(); bool relative = Ui_LightSettingsData::relative->isChecked(); light.setRelativeToCamera(relative); // position and direction if (!relative) { Vector3 diff = dir - pos; dir = diff; } light.setPosition(pos); light.setDirection(dir); light.setAttenuation(att); light.setIntensity((float)(intensity->value()) / 100.0); ///////////////////////////////////////////////////// // type of light if (ambient->isChecked()) { light.setType(LightSource::AMBIENT); } else if (point->isChecked()) { light.setType(LightSource::POSITIONAL); } else { light.setType(LightSource::DIRECTIONAL); } } catch (Exception::GeneralException& e) { Log.error() << "Invalid values in LightSettingsDialog" << std::endl; Log.error() << e; } }
void LightSettings::positionTypeChanged() { if (getCurrentLightNumber_() == -1 || ignore_) { return; } try { Vector3 pos = getPosition_(); Vector3 dir = getDirection_(); const Vector3& vp = stage_->getCamera().getViewPoint(); if (relative->isChecked()) { Vector3 diff = dir - pos; dir = stage_->calculateRelativeCoordinates(diff); pos -= vp; pos = stage_->calculateRelativeCoordinates(pos); } else { pos = stage_->calculateAbsoluteCoordinates(pos) + vp; dir = stage_->calculateAbsoluteCoordinates(dir) + pos; } setPosition_(pos); setDirection_(dir); } catch(...) { BALLVIEW_DEBUG } if (update_directly_checkBox->isChecked()) { apply(); scene_->lightsUpdated(true); } }
void CheckersBoard::setPositions( uint32_t x, uint32_t y, char piece ) { uint32_t position = getPosition_( x, y ); positions_[position] = piece; }
//used by human player bool CheckersBoard::hasPiece( uint32_t x, uint32_t y, char piece ) { uint32_t position = getPosition_( x, y ); return hasPiece_(position, piece); }