Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
cc08591d
Commit
cc08591d
authored
4 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Add string parser to Vector4
parent
01858532
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llmath/v4math.cpp
+24
-0
24 additions, 0 deletions
indra/llmath/v4math.cpp
indra/llmath/v4math.h
+5
-0
5 additions, 0 deletions
indra/llmath/v4math.h
with
29 additions
and
0 deletions
indra/llmath/v4math.cpp
+
24
−
0
View file @
cc08591d
...
@@ -35,6 +35,12 @@
...
@@ -35,6 +35,12 @@
// LLVector4
// LLVector4
// WARNING: Don't use these for global const definitions!
// For example:
// const LLQuaternion(0.5f * F_PI, LLVector3d::zero);
// at the top of a *.cpp file might not give you what you think.
const
LLVector4
LLVector4
::
zero
(
0.
f
,
0.
f
,
0.
f
,
0.
f
);
// Axis-Angle rotations
// Axis-Angle rotations
/*
/*
...
@@ -102,6 +108,24 @@ std::ostream& operator<<(std::ostream& s, const LLVector4 &a)
...
@@ -102,6 +108,24 @@ std::ostream& operator<<(std::ostream& s, const LLVector4 &a)
}
}
BOOL
LLVector4
::
parseVector4
(
const
std
::
string
&
buf
,
LLVector4
*
value
)
{
if
(
buf
.
empty
()
||
value
==
NULL
)
{
return
FALSE
;
}
LLVector4
v
;
S32
count
=
sscanf
(
buf
.
c_str
(),
"%lf %lf %lf %lf"
,
v
.
mV
+
0
,
v
.
mV
+
1
,
v
.
mV
+
2
,
v
.
mV
+
3
);
if
(
4
==
count
)
{
value
->
setVec
(
v
);
return
TRUE
;
}
return
FALSE
;
}
// Non-member functions
// Non-member functions
F32
angle_between
(
const
LLVector4
&
a
,
const
LLVector4
&
b
)
F32
angle_between
(
const
LLVector4
&
a
,
const
LLVector4
&
b
)
...
...
This diff is collapsed.
Click to expand it.
indra/llmath/v4math.h
+
5
−
0
View file @
cc08591d
...
@@ -44,6 +44,9 @@ class LLVector4
...
@@ -44,6 +44,9 @@ class LLVector4
{
{
public:
public:
F32
mV
[
LENGTHOFVECTOR4
];
F32
mV
[
LENGTHOFVECTOR4
];
const
static
LLVector4
zero
;
LLVector4
();
// Initializes LLVector4 to (0, 0, 0, 1)
LLVector4
();
// Initializes LLVector4 to (0, 0, 0, 1)
explicit
LLVector4
(
const
F32
*
vec
);
// Initializes LLVector4 to (vec[0]. vec[1], vec[2], vec[3])
explicit
LLVector4
(
const
F32
*
vec
);
// Initializes LLVector4 to (vec[0]. vec[1], vec[2], vec[3])
explicit
LLVector4
(
const
F64
*
vec
);
// Initialized LLVector4 to ((F32) vec[0], (F32) vec[1], (F32) vec[3], (F32) vec[4]);
explicit
LLVector4
(
const
F64
*
vec
);
// Initialized LLVector4 to ((F32) vec[0], (F32) vec[1], (F32) vec[3], (F32) vec[4]);
...
@@ -135,6 +138,8 @@ class LLVector4
...
@@ -135,6 +138,8 @@ class LLVector4
friend
const
LLVector4
&
operator
/=
(
LLVector4
&
a
,
F32
k
);
// Return a divided by scaler k
friend
const
LLVector4
&
operator
/=
(
LLVector4
&
a
,
F32
k
);
// Return a divided by scaler k
friend
LLVector4
operator
-
(
const
LLVector4
&
a
);
// Return vector -a
friend
LLVector4
operator
-
(
const
LLVector4
&
a
);
// Return vector -a
static
BOOL
parseVector4
(
const
std
::
string
&
buf
,
LLVector4
*
value
);
};
};
// Non-member functions
// Non-member functions
...
...
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