Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/Color.h
/* Copyright (C) 2019 Wildfire Games. | /* Copyright (C) 2020 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 9 Lines | |||||
#define INCLUDED_COLOR | #define INCLUDED_COLOR | ||||
#include "graphics/SColor.h" | #include "graphics/SColor.h" | ||||
#include "maths/Vector3D.h" | #include "maths/Vector3D.h" | ||||
#include "maths/Vector4D.h" | #include "maths/Vector4D.h" | ||||
// 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; | using RGBColor = CVector3D; | ||||
typedef CVector4D RGBAColor; | using RGBAColor = CVector4D; | ||||
// 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 | extern inline SColor4ub ConvertRGBColorTo4ub(const RGBColor& src); | ||||
// one of several implementations depending on CPU caps. | |||||
extern SColor4ub (*ConvertRGBColorTo4ub)(const RGBColor& src); | |||||
// call once ia32_Init has run; detects CPU caps and activates the best | |||||
// possible codepath. | |||||
extern void ColorActivateFastImpl(); | |||||
class CStr8; | class CStr8; | ||||
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) {} | ||||
Show All 40 Lines |
Wildfire Games · Phabricator