Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f40955bf
Commit
f40955bf
authored
Nov 10, 2007
by
Tony Wasserka
Committed by
Alexandre Julliard
Nov 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx8: Implement the C++ stuff of the D3DXCOLOR structure.
parent
94ccd3f0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
197 additions
and
0 deletions
+197
-0
d3dx8math.h
include/d3dx8math.h
+36
-0
d3dx8math.inl
include/d3dx8math.inl
+161
-0
No files found.
include/d3dx8math.h
View file @
f40955bf
...
@@ -220,6 +220,42 @@ typedef struct D3DXPLANE
...
@@ -220,6 +220,42 @@ typedef struct D3DXPLANE
typedef
struct
D3DXCOLOR
typedef
struct
D3DXCOLOR
{
{
#ifdef __cplusplus
D3DXCOLOR
();
D3DXCOLOR
(
DWORD
col
);
D3DXCOLOR
(
CONST
FLOAT
*
pf
);
D3DXCOLOR
(
CONST
D3DCOLORVALUE
&
col
);
D3DXCOLOR
(
FLOAT
fr
,
FLOAT
fg
,
FLOAT
fb
,
FLOAT
fa
);
operator
DWORD
()
const
;
operator
FLOAT
*
();
operator
CONST
FLOAT
*
()
const
;
operator
D3DCOLORVALUE
*
();
operator
CONST
D3DCOLORVALUE
*
()
const
;
operator
D3DCOLORVALUE
&
();
operator
CONST
D3DCOLORVALUE
&
()
const
;
D3DXCOLOR
&
operator
+=
(
CONST
D3DXCOLOR
&
);
D3DXCOLOR
&
operator
-=
(
CONST
D3DXCOLOR
&
);
D3DXCOLOR
&
operator
*=
(
FLOAT
);
D3DXCOLOR
&
operator
/=
(
FLOAT
);
D3DXCOLOR
operator
+
()
const
;
D3DXCOLOR
operator
-
()
const
;
D3DXCOLOR
operator
+
(
CONST
D3DXCOLOR
&
)
const
;
D3DXCOLOR
operator
-
(
CONST
D3DXCOLOR
&
)
const
;
D3DXCOLOR
operator
*
(
FLOAT
)
const
;
D3DXCOLOR
operator
/
(
FLOAT
)
const
;
friend
D3DXCOLOR
operator
*
(
FLOAT
,
CONST
D3DXCOLOR
&
);
BOOL
operator
==
(
CONST
D3DXCOLOR
&
)
const
;
BOOL
operator
!=
(
CONST
D3DXCOLOR
&
)
const
;
#endif
/* __cplusplus */
FLOAT
r
,
g
,
b
,
a
;
FLOAT
r
,
g
,
b
,
a
;
}
D3DXCOLOR
,
*
LPD3DXCOLOR
;
}
D3DXCOLOR
,
*
LPD3DXCOLOR
;
...
...
include/d3dx8math.inl
View file @
f40955bf
...
@@ -690,6 +690,167 @@ inline BOOL D3DXPLANE::operator != (CONST D3DXPLANE& pl) const
...
@@ -690,6 +690,167 @@ inline BOOL D3DXPLANE::operator != (CONST D3DXPLANE& pl) const
return a != pl.a || b != pl.b || c != pl.c || d != pl.d;
return a != pl.a || b != pl.b || c != pl.c || d != pl.d;
}
}
inline D3DXCOLOR::D3DXCOLOR()
{
}
inline D3DXCOLOR::D3DXCOLOR(DWORD col)
{
CONST FLOAT f = 1.0f / 255.0f;
r = f * (FLOAT)(unsigned char)(col >> 16);
g = f * (FLOAT)(unsigned char)(col >> 8);
b = f * (FLOAT)(unsigned char)col;
a = f * (FLOAT)(unsigned char)(col >> 24);
}
inline D3DXCOLOR::D3DXCOLOR(CONST FLOAT *pf)
{
if(!pf) return;
r = pf[0];
g = pf[1];
b = pf[2];
a = pf[3];
}
inline D3DXCOLOR::D3DXCOLOR(CONST D3DCOLORVALUE& col)
{
r = col.r;
g = col.g;
b = col.b;
a = col.a;
}
inline D3DXCOLOR::D3DXCOLOR(FLOAT fr, FLOAT fg, FLOAT fb, FLOAT fa)
{
r = fr;
g = fg;
b = fb;
a = fa;
}
inline D3DXCOLOR::operator DWORD () const
{
DWORD _r = r >= 1.0f ? 0xff : r <= 0.0f ? 0x00 : (DWORD)(r * 255.0f + 0.5f);
DWORD _g = g >= 1.0f ? 0xff : g <= 0.0f ? 0x00 : (DWORD)(g * 255.0f + 0.5f);
DWORD _b = b >= 1.0f ? 0xff : b <= 0.0f ? 0x00 : (DWORD)(b * 255.0f + 0.5f);
DWORD _a = a >= 1.0f ? 0xff : a <= 0.0f ? 0x00 : (DWORD)(a * 255.0f + 0.5f);
return (_a << 24) | (_r << 16) | (_g << 8) | _b;
}
inline D3DXCOLOR::operator FLOAT * ()
{
return (FLOAT*)&r;
}
inline D3DXCOLOR::operator CONST FLOAT * () const
{
return (CONST FLOAT*)&r;
}
inline D3DXCOLOR::operator D3DCOLORVALUE * ()
{
return (D3DCOLORVALUE*)&r;
}
inline D3DXCOLOR::operator CONST D3DCOLORVALUE * () const
{
return (CONST D3DCOLORVALUE*)&r;
}
inline D3DXCOLOR::operator D3DCOLORVALUE& ()
{
return *((D3DCOLORVALUE*)&r);
}
inline D3DXCOLOR::operator CONST D3DCOLORVALUE& () const
{
return *((CONST D3DCOLORVALUE*)&r);
}
inline D3DXCOLOR& D3DXCOLOR::operator += (CONST D3DXCOLOR& col)
{
r += col.r;
g += col.g;
b += col.b;
a += col.a;
return *this;
}
inline D3DXCOLOR& D3DXCOLOR::operator -= (CONST D3DXCOLOR& col)
{
r -= col.r;
g -= col.g;
b -= col.b;
a -= col.a;
return *this;
}
inline D3DXCOLOR& D3DXCOLOR::operator *= (FLOAT f)
{
r *= f;
g *= f;
b *= f;
a *= f;
return *this;
}
inline D3DXCOLOR& D3DXCOLOR::operator /= (FLOAT f)
{
FLOAT inv = 1.0f / f;
r *= inv;
g *= inv;
b *= inv;
a *= inv;
return *this;
}
inline D3DXCOLOR D3DXCOLOR::operator + () const
{
return *this;
}
inline D3DXCOLOR D3DXCOLOR::operator - () const
{
return D3DXCOLOR(-r, -g, -b, -a);
}
inline D3DXCOLOR D3DXCOLOR::operator + (CONST D3DXCOLOR& col) const
{
return D3DXCOLOR(r + col.r, g + col.g, b + col.b, a + col.a);
}
inline D3DXCOLOR D3DXCOLOR::operator - (CONST D3DXCOLOR& col) const
{
return D3DXCOLOR(r - col.r, g - col.g, b - col.b, a - col.a);
}
inline D3DXCOLOR D3DXCOLOR::operator * (FLOAT f) const
{
return D3DXCOLOR(r * f, g * f, b * f, a * f);
}
inline D3DXCOLOR D3DXCOLOR::operator / (FLOAT f) const
{
FLOAT inv = 1.0f / f;
return D3DXCOLOR(r * inv, g * inv, b * inv, a * inv);
}
inline D3DXCOLOR operator * (FLOAT f, CONST D3DXCOLOR& col)
{
return D3DXCOLOR(f * col.r, f * col.g, f * col.b, f * col.a);
}
inline BOOL D3DXCOLOR::operator == (CONST D3DXCOLOR& col) const
{
return r == col.r && g == col.g && b == col.b && a == col.a;
}
inline BOOL D3DXCOLOR::operator != (CONST D3DXCOLOR& col) const
{
return r != col.r || g != col.g || b != col.b || a != col.a;
}
#endif /* __cplusplus */
#endif /* __cplusplus */
/*_______________D3DXCOLOR_____________________*/
/*_______________D3DXCOLOR_____________________*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment