~ubuntu-branches/ubuntu/trusty/assimp/trusty-proposed

« back to all changes in this revision

Viewing changes to include/aiColor4D.h

  • Committer: Package Import Robot
  • Author(s): IOhannes m zmoelnig (gpg-key at iem)
  • Date: 2011-08-23 16:51:26 UTC
  • Revision ID: package-import@ubuntu.com-20110823165126-rvbjt1qtcusine1c
Tags: upstream-2.0.863+dfsg
ImportĀ upstreamĀ versionĀ 2.0.863+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
---------------------------------------------------------------------------
 
3
Open Asset Import Library (ASSIMP)
 
4
---------------------------------------------------------------------------
 
5
 
 
6
Copyright (c) 2006-2010, ASSIMP Development Team
 
7
 
 
8
All rights reserved.
 
9
 
 
10
Redistribution and use of this software in source and binary forms, 
 
11
with or without modification, are permitted provided that the following 
 
12
conditions are met:
 
13
 
 
14
* Redistributions of source code must retain the above
 
15
  copyright notice, this list of conditions and the
 
16
  following disclaimer.
 
17
 
 
18
* Redistributions in binary form must reproduce the above
 
19
  copyright notice, this list of conditions and the
 
20
  following disclaimer in the documentation and/or other
 
21
  materials provided with the distribution.
 
22
 
 
23
* Neither the name of the ASSIMP team, nor the names of its
 
24
  contributors may be used to endorse or promote products
 
25
  derived from this software without specific prior
 
26
  written permission of the ASSIMP Development Team.
 
27
 
 
28
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 
29
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 
30
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 
31
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
 
32
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
33
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
 
34
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 
35
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
 
36
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 
37
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
 
38
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
39
---------------------------------------------------------------------------
 
40
*/
 
41
/** @file aiColor4D.h
 
42
 *  @brief RGBA color structure, including operators when compiling in C++
 
43
 */
 
44
#ifndef AI_COLOR4D_H_INC
 
45
#define AI_COLOR4D_H_INC
 
46
 
 
47
#ifdef __cplusplus
 
48
extern "C" {
 
49
#endif
 
50
 
 
51
#include "./Compiler/pushpack1.h"
 
52
// ----------------------------------------------------------------------------------
 
53
/** Represents a color in Red-Green-Blue space including an 
 
54
*   alpha component. Color values range from 0 to 1. */
 
55
// ----------------------------------------------------------------------------------
 
56
struct aiColor4D
 
57
{
 
58
#ifdef __cplusplus
 
59
        aiColor4D () : r(0.0f), g(0.0f), b(0.0f), a(0.0f) {}
 
60
        aiColor4D (float _r, float _g, float _b, float _a) 
 
61
                : r(_r), g(_g), b(_b), a(_a) {}
 
62
        aiColor4D (float _r) : r(_r), g(_r), b(_r), a(_r) {}
 
63
        aiColor4D (const aiColor4D& o) 
 
64
                : r(o.r), g(o.g), b(o.b), a(o.a) {}
 
65
 
 
66
        // combined operators
 
67
        const aiColor4D& operator += (const aiColor4D& o);
 
68
        const aiColor4D& operator -= (const aiColor4D& o);
 
69
        const aiColor4D& operator *= (float f);
 
70
        const aiColor4D& operator /= (float f);
 
71
 
 
72
        // comparison
 
73
        bool operator == (const aiColor4D& other) const;
 
74
        bool operator != (const aiColor4D& other) const;
 
75
 
 
76
        // color tuple access, rgba order
 
77
        inline float operator[](unsigned int i) const;
 
78
        inline float& operator[](unsigned int i);
 
79
 
 
80
        /** check whether a color is (close to) black */
 
81
        inline bool IsBlack() const;
 
82
 
 
83
#endif // !__cplusplus
 
84
 
 
85
        // Red, green, blue and alpha color values 
 
86
        float r, g, b, a;
 
87
} PACK_STRUCT;  // !struct aiColor4D
 
88
 
 
89
#include "./Compiler/poppack1.h"
 
90
#ifdef __cplusplus
 
91
} // end extern "C"
 
92
 
 
93
#endif // __cplusplus
 
94
#endif // AI_VECTOR3D_H_INC