void lcLight::Initialize(const lcVector3& Position, const lcVector3& TargetPosition) { mState = 0; memset(m_strName, 0, sizeof(m_strName)); ChangeKey(mPositionKeys, Position, 1, true); ChangeKey(mTargetPositionKeys, TargetPosition, 1, true); ChangeKey(mAmbientColorKeys, lcVector4(0.0f, 0.0f, 0.0f, 1.0f), 1, true); ChangeKey(mDiffuseColorKeys, lcVector4(0.8f, 0.8f, 0.8f, 1.0f), 1, true); ChangeKey(mSpecularColorKeys, lcVector4(1.0f, 1.0f, 1.0f, 1.0f), 1, true); ChangeKey(mAttenuationKeys, lcVector3(1.0f, 0.0f, 0.0f), 1, true); ChangeKey(mSpotCutoffKeys, 30.0f, 1, true); ChangeKey(mSpotExponentKeys, 0.0f, 1, true); }
void lcLight::BoxTest(lcObjectBoxTest& ObjectBoxTest) const { if (IsPointLight()) { for (int PlaneIdx = 0; PlaneIdx < 6; PlaneIdx++) if (lcDot3(mPosition, ObjectBoxTest.Planes[PlaneIdx]) + ObjectBoxTest.Planes[PlaneIdx][3] > LC_LIGHT_SPHERE_RADIUS) return; ObjectBoxTest.Objects.Add(const_cast<lcLight*>(this)); return; } lcVector3 Min(-LC_LIGHT_POSITION_EDGE, -LC_LIGHT_POSITION_EDGE, -LC_LIGHT_POSITION_EDGE); lcVector3 Max(LC_LIGHT_POSITION_EDGE, LC_LIGHT_POSITION_EDGE, LC_LIGHT_POSITION_EDGE); lcVector4 LocalPlanes[6]; for (int PlaneIdx = 0; PlaneIdx < 6; PlaneIdx++) { lcVector3 Normal = lcMul30(ObjectBoxTest.Planes[PlaneIdx], mWorldLight); LocalPlanes[PlaneIdx] = lcVector4(Normal, ObjectBoxTest.Planes[PlaneIdx][3] - lcDot3(mWorldLight[3], Normal)); } if (lcBoundingBoxIntersectsVolume(Min, Max, LocalPlanes)) { ObjectBoxTest.Objects.Add(const_cast<lcLight*>(this)); return; } Min = lcVector3(-LC_LIGHT_TARGET_EDGE, -LC_LIGHT_TARGET_EDGE, -LC_LIGHT_TARGET_EDGE); Max = lcVector3(LC_LIGHT_TARGET_EDGE, LC_LIGHT_TARGET_EDGE, LC_LIGHT_TARGET_EDGE); lcMatrix44 WorldTarget = mWorldLight; WorldTarget.SetTranslation(lcMul30(-mTargetPosition, WorldTarget)); for (int PlaneIdx = 0; PlaneIdx < 6; PlaneIdx++) { lcVector3 Normal = lcMul30(ObjectBoxTest.Planes[PlaneIdx], WorldTarget); LocalPlanes[PlaneIdx] = lcVector4(Normal, ObjectBoxTest.Planes[PlaneIdx][3] - lcDot3(WorldTarget[3], Normal)); } if (lcBoundingBoxIntersectsVolume(Min, Max, LocalPlanes)) { ObjectBoxTest.Objects.Add(const_cast<lcLight*>(this)); return; } }
#include "lc_global.h" #include "lc_colors.h" #include "lc_file.h" #include <float.h> lcArray<lcColor> gColorList; lcColorGroup gColorGroups[LC_NUM_COLORGROUPS]; int gNumUserColors; int gEdgeColor; int gDefaultColor; lcVector4 gInterfaceColors[LC_NUM_INTERFACECOLORS] = // todo: make the colors configurable and include the grid and other hardcoded colors here as well. { lcVector4(0.8980f, 0.2980f, 0.4000f, 1.0000f), // LC_COLOR_SELECTED lcVector4(0.4000f, 0.2980f, 0.8980f, 1.0000f), // LC_COLOR_FOCUSED lcVector4(0.5f, 0.8f, 0.5f, 1.0f), // LC_COLOR_CAMERA lcVector4(0.5f, 0.8f, 0.5f, 1.0f) // LC_COLOR_LIGHT }; static const char sDefaultColorConfig[] = { "0 LDraw.org Configuration File\n" "0 Name: LDConfig.ldr\n" "0 Author: LDraw.org\n" "0 !LDRAW_ORG Configuration UPDATE 2013-03-08\n" "\n" "0 // LDraw Solid Colours\n" "0 !COLOUR Black CODE 0 VALUE #05131D EDGE #595959\n" "0 !COLOUR Blue CODE 1 VALUE #0055BF EDGE #333333\n" "0 !COLOUR Green CODE 2 VALUE #257A3E EDGE #333333\n" "0 !COLOUR Dark_Turquoise CODE 3 VALUE #00838F EDGE #333333\n"