HBITMAP KGUISkin::CreateBitmap(HDC hDC, FInt32 fFactor, bool bHor) { FInt32 fLight = L + (1.f - L) * fFactor; RGBQUAD rgb = KColor::HSL2RGB(H, S, fLight); COLORREF clr = KColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue).ToColor(); return CreateGradient(hDC, m_Color.ToColor(), clr, clr, bHor); }
KDNAMESTART KDNAMEGUI #define KUDEET_DEFAULT_BRUSH_SIZE 40 KGUISkin::KGUISkin() { m_BmpHorHover = NULL; m_BmpHor = NULL; m_BmpVer = NULL; m_BmpVerHover = NULL; m_BaseBrush = NULL; m_DecBrush = NULL; m_IncBrush = NULL; m_BmpBtnHoverV = NULL; m_BmpBtnNormalV = NULL; m_BmpBtnHover = NULL; m_BmpBtnNormal = NULL; m_BmpTitle = NULL; m_BmpHighlight = NULL; m_hICON = NULL; m_TextColor = RGB(0, 0, 0); m_bColorDirty = true; m_nWidth = KUDEET_DEFAULT_BRUSH_SIZE; //SetBaseColor(220, 0.5f, 0.5f); // HSL SetBaseColor(KColor(0x22, 0x75, 0xA0)); //SetBaseColor(0x22, 0x75, 0xA0); }
void KGUISkin::SetBaseColor(KColor & color) { if (m_Color.ToColor() == color.ToColor()) return; m_Color = color; RGBQUAD rgb = { color.m_B, color.m_G, color.m_R }; KColor::RGB2HSL(&rgb, &H, &S, &L); m_ReverseColor.m_B = 255 - m_Color.m_B; m_ReverseColor.m_G = 255 - m_Color.m_G; m_ReverseColor.m_R = 255 - m_Color.m_R; m_IncColor = KColor(ColorAdjustLuma(RGB(m_Color.m_R, m_Color.m_G, m_Color.m_B), 200, TRUE)); m_DecColor = KColor(ColorAdjustLuma(RGB(m_Color.m_R, m_Color.m_G, m_Color.m_B), -200, TRUE)); InitialSkin(); }
void KOrthogonalMap::initeLayer(const KOrthoNode &Node, KOrthoLayer &Layer) { Layer.textureID = Node.verts[0].tindex; Layer.blend = KColor(Node.verts[0].r, Node.verts[0].g, Node.verts[0].b, Node.verts[0].a); Layer.atlas = _ktilesetStamp.getStamp(Node.atlasID).atlas; Layer.layerIndex = Node.layerIndex; if (Node.fliph) Layer.atlas.flipH(); if (Node.flipv) Layer.atlas.flipV(); #if defined(KITE_EDITOR) Layer.sceneItem = Node.sceneItem; #endif }
void KGUISkin::SetBaseColor(COLORREF clrValue) { SetBaseColor(KColor(clrValue)); }
void KGUISkin::SetBaseColor(FInt32 fH, FInt32 fS, FInt32 fL) { H = fH; S = fS; L = fL; RGBQUAD rgb = KColor::HSL2RGB(H, S, L); SetBaseColor(KColor(rgb.rgbRed, rgb.rgbGreen, rgb.rgbBlue)); }
KColor TracingInstance::GetBackGroundColor(const KVec3& dir) const { return KColor(0,0,0); }
bool SceneLoader::LoadFromFile(const char* file_name) { KTimer stop_watch(true); FILE* pFile = NULL; bool ret = false; int ext = _FileExtension(file_name); std::string file_dir; GetPathDir(file_name, file_dir); Texture::TextureManager::GetInstance()->AddSearchPath(file_dir.c_str()); if (!mpScene) mpScene = new KSceneSet; else mpScene->Reset(); mIsFromOBJ = false; mIsSceneLoaded = false; KTimer fileReadingTime(true); // Perform the file reading if (ext == FILE_EXT_OBJ) { KRT_ObjFileLoader OBJLoader; OBJLoader.mUseTexMap = USE_TEX_MAP ? true : false; // Create scene UINT32 kd_idx = 0; KScene* pKDScene = mpScene->AddKDScene(kd_idx); mpScene->SceneNode_Create(kd_idx); if (OBJLoader.LoadObjFile(file_name, *pKDScene)) { ret = true; mIsFromOBJ = true; } else { mpScene->Reset(); ret = false; } } else if (ext == FILE_EXT_ABC) { if (mAbcLoader.Load(file_name, *mpScene)) ret = true; else { mpScene->Reset(); ret = false; } } if (ret) { BuildNodeIdMap(); mIsSceneLoaded = true; } mFileLoadingTime = UINT32(fileReadingTime.Stop() * 1000); // End of file reading, now build the acceleration structure mpAccelData = new KAccelStruct_BVH(mpScene); mpAccelData->SceneNode_BuildAccelData(NULL); KBBox scene_box = mpAccelData->GetSceneBBox(); KVec3 center = scene_box.Center(); float radius = nvmath::length(scene_box.mMax - scene_box.mMin) * 1.0f; CameraManager* pCameraMan = CameraManager::GetInstance(); if (pCameraMan->GetCameraCnt() == 0 && mpScene) { // If there's no camera, create a default light regarding the bounding box of scene KCamera* pPinHoleCamera = pCameraMan->OpenCamera("__default", true); KCamera::MotionState ms; ms.pos = center + KVec3(0.5,0.5,0.5)*radius; ms.lookat = center; ms.up = KVec3(0, 1.0f, 0); ms.xfov = 45.0f; ms.focal = radius * 0.5f; pPinHoleCamera->SetupStillCamera(ms); } LightScheme* pLightScheme = LightScheme::GetInstance(); if (pLightScheme->GetLightCount() == 0 && mpScene) { // If there's no light source, create a default one, otherwize the scene will be entirely dark. PointLightBase* pLight0 = dynamic_cast<PointLightBase*>(pLightScheme->CreateLightSource(POINT_LIGHT_TYPE)); PointLightBase* pLight1 = dynamic_cast<PointLightBase*>(pLightScheme->CreateLightSource(POINT_LIGHT_TYPE)); pLight0->SetIntensity(KColor(0.55f, 0.55f, 0.55f)); pLight1->SetIntensity(KColor(0.55f, 0.55f, 0.55f)); pLight0->SetPos(center + KVec3(0,1,1)*(radius*3.0f)); pLight1->SetPos(center + KVec3(1,1,0)*(radius*3.0f)); } if (pFile) fclose(pFile); mLoadingTime = stop_watch.Stop(); return ret; }