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
ec3bc2ee
Commit
ec3bc2ee
authored
18 years ago
by
Amorilia
Browse files
Options
Downloads
Patches
Plain Diff
XML update; niflib IO update to improve compilation with generated code.
parent
0083c662
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
NIF_IO.cpp
+30
-1
30 additions, 1 deletion
NIF_IO.cpp
NIF_IO.h
+12
-15
12 additions, 15 deletions
NIF_IO.h
with
42 additions
and
16 deletions
NIF_IO.cpp
+
30
−
1
View file @
ec3bc2ee
...
@@ -123,6 +123,13 @@ ostream & operator<<(ostream & lh, usVector3 const & rh) {
...
@@ -123,6 +123,13 @@ ostream & operator<<(ostream & lh, usVector3 const & rh) {
/**
/**
* Read utility functions
* Read utility functions
*/
*/
int
ReadInt
(
istream
&
in
){
int
tmp
;
in
.
read
(
(
char
*
)
&
tmp
,
4
);
return
tmp
;
}
uint
ReadUInt
(
istream
&
in
){
uint
ReadUInt
(
istream
&
in
){
uint
tmp
;
uint
tmp
;
...
@@ -209,6 +216,11 @@ bool ReadBool( istream &in, unsigned int version ) {
...
@@ -209,6 +216,11 @@ bool ReadBool( istream &in, unsigned int version ) {
/**
/**
* Write utility functions.
* Write utility functions.
*/
*/
void
WriteInt
(
int
val
,
ostream
&
out
){
out
.
write
(
(
char
*
)
&
val
,
4
);
}
void
WriteUInt
(
uint
val
,
ostream
&
out
){
void
WriteUInt
(
uint
val
,
ostream
&
out
){
out
.
write
(
(
char
*
)
&
val
,
4
);
out
.
write
(
(
char
*
)
&
val
,
4
);
...
@@ -335,10 +347,12 @@ ostream & operator<<(ostream & lh, Bin const & rh) {
...
@@ -335,10 +347,12 @@ ostream & operator<<(ostream & lh, Bin const & rh) {
//--Overloaded versions of Read/Write functions ReadData/WriteData
//--Overloaded versions of Read/Write functions ReadData/WriteData
void
NifStream
(
int
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadInt
(
in
);
};
void
NifStream
(
uint
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadUInt
(
in
);
};
void
NifStream
(
uint
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadUInt
(
in
);
};
void
NifStream
(
ushort
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadUShort
(
in
);
};
void
NifStream
(
ushort
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadUShort
(
in
);
};
void
NifStream
(
short
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadShort
(
in
);
};
void
NifStream
(
short
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadShort
(
in
);
};
void
NifStream
(
byte
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadByte
(
in
);
};
void
NifStream
(
byte
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadByte
(
in
);
};
void
NifStream
(
bool
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadBool
(
in
,
version
);
};
void
NifStream
(
float
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadFloat
(
in
);
};
void
NifStream
(
float
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadFloat
(
in
);
};
void
NifStream
(
string
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadString
(
in
);
};
void
NifStream
(
string
&
val
,
istream
&
in
,
uint
version
)
{
val
=
ReadString
(
in
);
};
void
NifStream
(
KeyType
&
val
,
istream
&
in
,
uint
version
)
{
val
=
KeyType
(
ReadUInt
(
in
));
};
void
NifStream
(
KeyType
&
val
,
istream
&
in
,
uint
version
)
{
val
=
KeyType
(
ReadUInt
(
in
));
};
...
@@ -412,12 +426,24 @@ void NifStream( TexDesc & val, istream& in, uint version ) {
...
@@ -412,12 +426,24 @@ void NifStream( TexDesc & val, istream& in, uint version ) {
}
}
}
}
void
NifStream
(
IBlock
*
val
,
istream
&
in
,
uint
version
)
{
int
n
;
in
.
read
(
(
char
*
)
&
n
,
4
);
val
=
0
;
// TODO: do something with that n, something like this:
//if ( n == -1 )
// val = 0;
//else
// val = blk_ref(n);
// BUT: block n may not have been processed yet, so we can't return a pointer... ? they will have to be
// resolved when calling FixLinks()?
};
void
NifStream
(
int
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteInt
(
val
,
out
);
}
void
NifStream
(
uint
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteUInt
(
val
,
out
);
}
void
NifStream
(
uint
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteUInt
(
val
,
out
);
}
void
NifStream
(
ushort
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteUShort
(
val
,
out
);
}
void
NifStream
(
ushort
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteUShort
(
val
,
out
);
}
void
NifStream
(
short
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteShort
(
val
,
out
);
}
void
NifStream
(
short
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteShort
(
val
,
out
);
}
void
NifStream
(
byte
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteByte
(
val
,
out
);
}
void
NifStream
(
byte
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteByte
(
val
,
out
);
}
void
NifStream
(
bool
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteBool
(
val
,
out
,
version
);
}
void
NifStream
(
float
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteFloat
(
val
,
out
);
}
void
NifStream
(
float
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteFloat
(
val
,
out
);
}
void
NifStream
(
string
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteString
(
val
,
out
);
}
void
NifStream
(
string
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteString
(
val
,
out
);
}
void
NifStream
(
KeyType
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteUInt
(
val
,
out
);
}
void
NifStream
(
KeyType
const
&
val
,
ostream
&
out
,
uint
version
)
{
WriteUInt
(
val
,
out
);
}
...
@@ -484,6 +510,9 @@ void NifStream( TexDesc const & val, ostream& out, uint version ) {
...
@@ -484,6 +510,9 @@ void NifStream( TexDesc const & val, ostream& out, uint version ) {
}
}
}
}
};
};
void
NifStream
(
IBlock
const
*
const
val
,
ostream
&
out
,
uint
version
)
{
NifStream
(
val
->
GetBlockNum
(),
out
,
version
);
};
string
HexString
(
const
byte
*
src
,
uint
len
)
{
string
HexString
(
const
byte
*
src
,
uint
len
)
{
stringstream
out
;
stringstream
out
;
...
...
This diff is collapsed.
Click to expand it.
NIF_IO.h
+
12
−
15
View file @
ec3bc2ee
...
@@ -155,6 +155,7 @@ ostream & operator<<(ostream & lh, usVector3 const & rh);
...
@@ -155,6 +155,7 @@ ostream & operator<<(ostream & lh, usVector3 const & rh);
/**
/**
* Read utility functions
* Read utility functions
*/
*/
int
ReadInt
(
istream
&
in
);
uint
ReadUInt
(
istream
&
in
);
uint
ReadUInt
(
istream
&
in
);
ushort
ReadUShort
(
istream
&
in
);
ushort
ReadUShort
(
istream
&
in
);
short
ReadShort
(
istream
&
in
);
short
ReadShort
(
istream
&
in
);
...
@@ -168,10 +169,12 @@ void ReadFVector3( fVector3& fvec, istream& in );
...
@@ -168,10 +169,12 @@ void ReadFVector3( fVector3& fvec, istream& in );
void
ReadFVector4
(
fVector4
&
fvec
,
istream
&
in
);
void
ReadFVector4
(
fVector4
&
fvec
,
istream
&
in
);
//Read
//Read
void
NifStream
(
int
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
uint
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
uint
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
ushort
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
ushort
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
short
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
short
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
byte
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
byte
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
bool
&
val
,
istream
&
in
,
uint
version
);
// version is significant
void
NifStream
(
float
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
float
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
string
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
string
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
Vector3
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
Vector3
&
val
,
istream
&
in
,
uint
version
=
0
);
...
@@ -181,6 +184,7 @@ void NifStream( Color4 & val, istream& in, uint version = 0 );
...
@@ -181,6 +184,7 @@ void NifStream( Color4 & val, istream& in, uint version = 0 );
void
NifStream
(
Triangle
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
Triangle
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
TexDesc
&
val
,
istream
&
in
,
uint
version
);
// version is significant
void
NifStream
(
TexDesc
&
val
,
istream
&
in
,
uint
version
);
// version is significant
void
NifStream
(
LODRange
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
LODRange
&
val
,
istream
&
in
,
uint
version
=
0
);
void
NifStream
(
IBlock
*
val
,
istream
&
in
,
uint
version
=
0
);
template
<
class
T
>
template
<
class
T
>
void
NifStream
(
Key
<
T
>
&
key
,
istream
&
file
,
KeyType
type
)
{
void
NifStream
(
Key
<
T
>
&
key
,
istream
&
file
,
KeyType
type
)
{
...
@@ -212,10 +216,10 @@ void NifStream( Key<T> & key, istream& file, KeyType type ) {
...
@@ -212,10 +216,10 @@ void NifStream( Key<T> & key, istream& file, KeyType type ) {
void
StreamQuatKey
(
Key
<
Quaternion
>
&
key
,
istream
&
file
,
KeyType
type
);
void
StreamQuatKey
(
Key
<
Quaternion
>
&
key
,
istream
&
file
,
KeyType
type
);
template
<
class
T
>
template
<
class
T
>
void
NifStream
(
vector
<
T
>
&
val
,
istream
&
file
)
{
void
NifStream
(
vector
<
T
>
&
val
,
istream
&
file
,
uint
version
=
0
)
{
typename
vector
<
T
>::
iterator
it
;
typename
vector
<
T
>::
iterator
it
;
for
(
it
=
val
.
begin
();
it
!=
val
.
end
();
++
it
)
{
for
(
it
=
val
.
begin
();
it
!=
val
.
end
();
++
it
)
{
NifStream
(
*
it
,
file
);
NifStream
(
*
it
,
file
,
version
);
}
}
}
}
...
@@ -223,35 +227,27 @@ void NifStream( vector<T> & val, istream& file ) {
...
@@ -223,35 +227,27 @@ void NifStream( vector<T> & val, istream& file ) {
/**
/**
* Write utility functions.
* Write utility functions.
*/
*/
void
WriteInt
(
int
val
,
ostream
&
out
);
void
WriteUInt
(
uint
val
,
ostream
&
out
);
void
WriteUInt
(
uint
val
,
ostream
&
out
);
void
WriteUShort
(
ushort
val
,
ostream
&
out
);
void
WriteUShort
(
ushort
val
,
ostream
&
out
);
void
WriteShort
(
short
val
,
ostream
&
out
);
void
WriteShort
(
short
val
,
ostream
&
out
);
void
WriteByte
(
byte
val
,
ostream
&
out
);
void
WriteByte
(
byte
val
,
ostream
&
out
);
void
WriteUSVector3
(
usVector3
const
&
fvec
,
ostream
&
out
);
void
WriteUSVector3
(
usVector3
const
&
fvec
,
ostream
&
out
);
void
WriteFloat
(
float
val
,
ostream
&
out
);
void
WriteFloat
(
float
val
,
ostream
&
out
);
void
WriteString
(
string
const
&
val
,
ostream
&
out
);
void
WriteString
(
string
const
&
val
,
ostream
&
out
);
void
WriteBool
(
bool
val
,
ostream
&
out
,
unsigned
int
version
);
void
WriteBool
(
bool
val
,
ostream
&
out
,
unsigned
int
version
);
void
WriteFVector2
(
fVector2
const
&
fvec
,
ostream
&
out
);
void
WriteFVector2
(
fVector2
const
&
fvec
,
ostream
&
out
);
void
WriteFVector3
(
fVector3
const
&
fvec
,
ostream
&
out
);
void
WriteFVector3
(
fVector3
const
&
fvec
,
ostream
&
out
);
void
WriteFVector4
(
fVector4
const
&
fvec
,
ostream
&
out
);
void
WriteFVector4
(
fVector4
const
&
fvec
,
ostream
&
out
);
void
WriteBlockName
(
const
char
*
name
,
uint
nameLength
,
ostream
&
out
);
void
WriteBlockName
(
const
char
*
name
,
uint
nameLength
,
ostream
&
out
);
//Write
//Write
void
NifStream
(
int
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
uint
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
uint
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
ushort
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
ushort
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
short
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
short
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
byte
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
byte
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
bool
const
&
val
,
ostream
&
out
,
uint
version
);
// version is significant
void
NifStream
(
float
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
float
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
string
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
string
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
Vector3
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
Vector3
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
...
@@ -261,6 +257,7 @@ void NifStream( Color4 const & val, ostream& out, uint version = 0 );
...
@@ -261,6 +257,7 @@ void NifStream( Color4 const & val, ostream& out, uint version = 0 );
void
NifStream
(
Triangle
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
Triangle
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
TexDesc
const
&
val
,
ostream
&
out
,
uint
version
);
// version is significant
void
NifStream
(
TexDesc
const
&
val
,
ostream
&
out
,
uint
version
);
// version is significant
void
NifStream
(
LODRange
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
LODRange
const
&
val
,
ostream
&
out
,
uint
version
=
0
);
void
NifStream
(
IBlock
const
*
const
val
,
ostream
&
out
,
uint
version
=
0
);
template
<
class
T
>
template
<
class
T
>
void
NifStream
(
Key
<
T
>
const
&
key
,
ostream
&
file
,
KeyType
type
)
{
void
NifStream
(
Key
<
T
>
const
&
key
,
ostream
&
file
,
KeyType
type
)
{
...
@@ -290,10 +287,10 @@ void NifStream( Key<T> const & key, ostream& file, KeyType type ) {
...
@@ -290,10 +287,10 @@ void NifStream( Key<T> const & key, ostream& file, KeyType type ) {
void
StreamQuatKey
(
Key
<
Quaternion
>
const
&
key
,
ostream
&
file
,
KeyType
type
);
void
StreamQuatKey
(
Key
<
Quaternion
>
const
&
key
,
ostream
&
file
,
KeyType
type
);
template
<
class
T
>
template
<
class
T
>
void
NifStream
(
vector
<
T
>
const
&
val
,
ostream
&
file
)
{
void
NifStream
(
vector
<
T
>
const
&
val
,
ostream
&
file
,
uint
version
=
0
)
{
typename
vector
<
T
>::
const_iterator
it
;
typename
vector
<
T
>::
const_iterator
it
;
for
(
it
=
val
.
begin
();
it
!=
val
.
end
();
++
it
)
{
for
(
it
=
val
.
begin
();
it
!=
val
.
end
();
++
it
)
{
NifStream
(
*
it
,
file
);
NifStream
(
*
it
,
file
,
version
);
}
}
}
}
...
...
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