Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Niflib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Grant Kim
Niflib
Commits
381a876b
Commit
381a876b
authored
14 years ago
by
DragonGeo2
Committed by
Amorilia
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Some math operators for TexCoord and Color4 (cherry-picked from aedra svn revision 48).
parent
c11061ed
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
change_log.txt
+1
-0
1 addition, 0 deletions
change_log.txt
include/nif_math.h
+49
-0
49 additions, 0 deletions
include/nif_math.h
with
50 additions
and
0 deletions
change_log.txt
+
1
−
0
View file @
381a876b
...
...
@@ -635,4 +635,5 @@
==Version 0.7.3==
* AsQuaternion is now a const member function (contributed by Dragongeo2).
* Some math operators for TexCoord and Color4 (contributed by Dragongeo2).
This diff is collapsed.
Click to expand it.
include/nif_math.h
+
49
−
0
View file @
381a876b
...
...
@@ -45,6 +45,33 @@ struct TexCoord {
/*! Default constructor */
NIFLIB_API
TexCoord
()
:
u
(
0.0
f
),
v
(
0.0
f
)
{}
NIFLIB_API
TexCoord
operator
+
(
const
TexCoord
&
rhs
)
const
{
TexCoord
ret
;
ret
=
*
this
;
ret
.
u
+=
rhs
.
u
;
ret
.
v
+=
rhs
.
v
;
return
ret
;
}
NIFLIB_API
TexCoord
operator
-
(
const
TexCoord
&
rhs
)
const
{
TexCoord
ret
;
ret
=
*
this
;
ret
.
u
-=
rhs
.
u
;
ret
.
v
-=
rhs
.
v
;
return
ret
;
}
NIFLIB_API
TexCoord
operator
*
(
const
float
rhs
)
const
{
TexCoord
ret
;
ret
=
*
this
;
ret
.
u
*=
rhs
;
ret
.
v
*=
rhs
;
return
ret
;
}
/*! This constructor can be used to set all values in this structure during initialization
* \param[in] u The value to set U to.
* \param[in] v The value to set V to.
...
...
@@ -958,6 +985,28 @@ struct Color4 {
float
b
;
/*!< The blue component of this color. Should be between 0.0f and 1.0f. */
float
a
;
/*!< The alpha translucency component of this color. Should be between 0.0f and 1.0f. */
NIFLIB_API
Color4
operator
+
(
const
Color4
&
rhs
)
const
{
Color4
ret
;
ret
=
*
this
;
ret
.
r
+=
rhs
.
r
;
ret
.
g
+=
rhs
.
g
;
ret
.
b
+=
rhs
.
b
;
ret
.
a
+=
rhs
.
a
;
return
ret
;
}
NIFLIB_API
Color4
operator
*
(
const
float
rhs
)
const
{
Color4
ret
;
ret
=
*
this
;
ret
.
r
*=
rhs
;
ret
.
g
*=
rhs
;
ret
.
b
*=
rhs
;
ret
.
a
*=
rhs
;
return
ret
;
}
/*! Default constructor */
NIFLIB_API
Color4
()
:
r
(
0.0
f
),
g
(
0.0
f
),
b
(
0.0
f
),
a
(
0.0
f
)
{}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment