Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/Color.h
/* Copyright (C) 2022 Wildfire Games. | /* Copyright (C) 2023 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 17 Lines | |||||
// Simple defines for 3 and 4 component floating point colors - just map to | // Simple defines for 3 and 4 component floating point colors - just map to | ||||
// corresponding vector types. | // corresponding vector types. | ||||
typedef CVector3D RGBColor; | typedef CVector3D RGBColor; | ||||
typedef CVector4D RGBAColor; | typedef CVector4D RGBAColor; | ||||
// Convert float RGB(A) colors to unsigned byte. | // Convert float RGB(A) colors to unsigned byte. | ||||
// Exposed as function pointer because it is set at init-time to | // Exposed as function pointer because it is set at init-time to | ||||
// one of several implementations depending on CPU caps. | // one of several implementations depending on CPU caps. | ||||
extern SColor4ub (*ConvertRGBColorTo4ub)(const RGBColor& src); | SColor4ub ConvertRGBColorTo4ub(const RGBColor& src); | ||||
/** | |||||
* Detects CPU caps and activates the best possible codepath. | |||||
*/ | |||||
extern void ColorActivateFastImpl(); | |||||
struct CColor | struct CColor | ||||
{ | { | ||||
CColor() : r(-1.f), g(-1.f), b(-1.f), a(1.f) {} | CColor() : r(-1.f), g(-1.f), b(-1.f), a(1.f) {} | ||||
CColor(float cr, float cg, float cb, float ca) : r(cr), g(cg), b(cb), a(ca) {} | CColor(float cr, float cg, float cb, float ca) : r(cr), g(cg), b(cb), a(ca) {} | ||||
/** | /** | ||||
* Returns whether this has been set to a valid color. | * Returns whether this has been set to a valid color. | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator