Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 09:30:08

0001 /*
0002 ---------------------------------------------------------------------------
0003 Open Asset Import Library (assimp)
0004 ---------------------------------------------------------------------------
0005 
0006 Copyright (c) 2006-2024, assimp team
0007 
0008 All rights reserved.
0009 
0010 Redistribution and use of this software in source and binary forms,
0011 with or without modification, are permitted provided that the following
0012 conditions are met:
0013 
0014 * Redistributions of source code must retain the above
0015   copyright notice, this list of conditions and the
0016   following disclaimer.
0017 
0018 * Redistributions in binary form must reproduce the above
0019   copyright notice, this list of conditions and the
0020   following disclaimer in the documentation and/or other
0021   materials provided with the distribution.
0022 
0023 * Neither the name of the assimp team, nor the names of its
0024   contributors may be used to endorse or promote products
0025   derived from this software without specific prior
0026   written permission of the assimp team.
0027 
0028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0030 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0031 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0032 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0033 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0034 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0035 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0036 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0037 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0038 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0039 ---------------------------------------------------------------------------
0040 */
0041 /** @file color4.h
0042  *  @brief RGBA color structure, including operators when compiling in C++
0043  */
0044 #pragma once
0045 #ifndef AI_COLOR4D_H_INC
0046 #define AI_COLOR4D_H_INC
0047 
0048 #ifdef __GNUC__
0049 #   pragma GCC system_header
0050 #endif
0051 
0052 #include <assimp/defs.h>
0053 
0054 #ifdef __cplusplus
0055 
0056 // ----------------------------------------------------------------------------------
0057 /** Represents a color in Red-Green-Blue space including an
0058 *   alpha component. Color values range from 0 to 1. */
0059 // ----------------------------------------------------------------------------------
0060 template <typename TReal>
0061 class aiColor4t {
0062 public:
0063     aiColor4t() AI_NO_EXCEPT : r(), g(), b(), a() {}
0064     aiColor4t (TReal _r, TReal _g, TReal _b, TReal _a)
0065         : r(_r), g(_g), b(_b), a(_a) {}
0066     explicit aiColor4t (TReal _r) : r(_r), g(_r), b(_r), a(_r) {}
0067     aiColor4t (const aiColor4t& o) = default;
0068 
0069     // combined operators
0070     const aiColor4t& operator += (const aiColor4t& o);
0071     const aiColor4t& operator -= (const aiColor4t& o);
0072     const aiColor4t& operator *= (TReal f);
0073     const aiColor4t& operator /= (TReal f);
0074 
0075     // comparison
0076     bool operator == (const aiColor4t& other) const;
0077     bool operator != (const aiColor4t& other) const;
0078     bool operator <  (const aiColor4t& other) const;
0079 
0080     // color tuple access, rgba order
0081     inline TReal operator[](unsigned int i) const;
0082     inline TReal& operator[](unsigned int i);
0083 
0084     /** check whether a color is (close to) black */
0085     inline bool IsBlack() const;
0086 
0087     // Red, green, blue and alpha color values
0088     TReal r, g, b, a;
0089 };  // !struct aiColor4D
0090 
0091 typedef aiColor4t<float> aiColor4D;
0092 
0093 #else
0094 
0095 struct aiColor4D {
0096     float r, g, b, a;
0097 };
0098 
0099 #endif // __cplusplus
0100 
0101 #endif // AI_COLOR4D_H_INC