Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nifplg
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
nifplg
Commits
cd6693d1
Commit
cd6693d1
authored
18 years ago
by
Gundalf
Browse files
Options
Downloads
Patches
Plain Diff
Fixed meshes without uv coordinates. Fixed holes in generated collision geometry.
parent
67e1aa38
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
NifExport/Exporter.h
+0
-1
0 additions, 1 deletion
NifExport/Exporter.h
NifExport/Mesh.cpp
+18
-10
18 additions, 10 deletions
NifExport/Mesh.cpp
NifExport/NifExport.cpp
+1
-1
1 addition, 1 deletion
NifExport/NifExport.cpp
NifExport/Strips.cpp
+48
-35
48 additions, 35 deletions
NifExport/Strips.cpp
with
67 additions
and
47 deletions
NifExport/Exporter.h
+
0
−
1
View file @
cd6693d1
...
@@ -114,7 +114,6 @@ private:
...
@@ -114,7 +114,6 @@ private:
void
getTextureMatrix
(
Matrix3
&
mat
,
Mtl
*
mtl
);
void
getTextureMatrix
(
Matrix3
&
mat
,
Mtl
*
mtl
);
/* havok & collision */
/* havok & collision */
bool
hasCollision
(
INode
*
node
);
int
addVertex
(
vector
<
Vector3
>
&
verts
,
vector
<
Vector3
>
&
vnorms
,
const
Point3
&
pt
,
const
Point3
&
norm
);
int
addVertex
(
vector
<
Vector3
>
&
verts
,
vector
<
Vector3
>
&
vnorms
,
const
Point3
&
pt
,
const
Point3
&
norm
);
void
addFace
(
Triangles
&
tris
,
vector
<
Vector3
>
&
verts
,
vector
<
Vector3
>
&
vnorms
,
void
addFace
(
Triangles
&
tris
,
vector
<
Vector3
>
&
verts
,
vector
<
Vector3
>
&
vnorms
,
int
face
,
const
int
vi
[
3
],
Mesh
*
mesh
);
int
face
,
const
int
vi
[
3
],
Mesh
*
mesh
);
...
...
This diff is collapsed.
Click to expand it.
NifExport/Mesh.cpp
+
18
−
10
View file @
cd6693d1
...
@@ -96,8 +96,12 @@ bool Exporter::makeMesh(NiNodeRef &parent, Mtl *mtl, FaceGroup &grp)
...
@@ -96,8 +96,12 @@ bool Exporter::makeMesh(NiNodeRef &parent, Mtl *mtl, FaceGroup &grp)
data
->
SetVertices
(
grp
.
verts
);
data
->
SetVertices
(
grp
.
verts
);
data
->
SetNormals
(
grp
.
vnorms
);
data
->
SetNormals
(
grp
.
vnorms
);
data
->
SetUVSetCount
(
1
);
data
->
SetUVSet
(
0
,
grp
.
uvs
);
if
(
grp
.
uvs
.
size
()
>
0
)
{
data
->
SetUVSetCount
(
1
);
data
->
SetUVSet
(
0
,
grp
.
uvs
);
}
if
(
grp
.
vcolors
.
size
()
>
0
)
if
(
grp
.
vcolors
.
size
()
>
0
)
data
->
SetVertexColors
(
grp
.
vcolors
);
data
->
SetVertexColors
(
grp
.
vcolors
);
...
@@ -116,13 +120,12 @@ bool Exporter::makeMesh(NiNodeRef &parent, Mtl *mtl, FaceGroup &grp)
...
@@ -116,13 +120,12 @@ bool Exporter::makeMesh(NiNodeRef &parent, Mtl *mtl, FaceGroup &grp)
int
Exporter
::
addVertex
(
FaceGroup
&
grp
,
int
face
,
int
vi
,
Mesh
*
mesh
,
const
Matrix3
&
texm
)
int
Exporter
::
addVertex
(
FaceGroup
&
grp
,
int
face
,
int
vi
,
Mesh
*
mesh
,
const
Matrix3
&
texm
)
{
{
Point3
pt
=
mesh
->
verts
[
mesh
->
faces
[
face
].
v
[
vi
]
];
Point3
pt
=
mesh
->
verts
[
mesh
->
faces
[
face
].
v
[
vi
]
];
Point3
uv
=
mesh
->
tVerts
[
mesh
->
tvFace
[
face
].
t
[
vi
]]
*
texm
;
Point3
norm
=
getVertexNormal
(
mesh
,
face
,
mesh
->
getRVertPtr
(
mesh
->
faces
[
face
].
v
[
vi
]));
Point3
norm
=
getVertexNormal
(
mesh
,
face
,
mesh
->
getRVertPtr
(
mesh
->
faces
[
face
].
v
[
vi
]));
/* uv.z =
uv
.x
;
Point3
uv
;
uv.x = uv.y;
if
(
mesh
->
tvFace
)
uv
.y
=
uv.z
;
uv
=
mesh
->
tVerts
[
mesh
->
tvFace
[
face
].
t
[
vi
]]
*
texm
;
*/
VertColor
col
;
VertColor
col
;
if
(
mVertexColors
&&
mesh
->
vertCol
)
if
(
mVertexColors
&&
mesh
->
vertCol
)
col
=
mesh
->
vertCol
[
mesh
->
vcFace
[
face
].
t
[
vi
]
];
col
=
mesh
->
vertCol
[
mesh
->
vcFace
[
face
].
t
[
vi
]
];
...
@@ -130,9 +133,11 @@ int Exporter::addVertex(FaceGroup &grp, int face, int vi, Mesh *mesh, const Matr
...
@@ -130,9 +133,11 @@ int Exporter::addVertex(FaceGroup &grp, int face, int vi, Mesh *mesh, const Matr
for
(
int
i
=
0
;
i
<
grp
.
verts
.
size
();
i
++
)
for
(
int
i
=
0
;
i
<
grp
.
verts
.
size
();
i
++
)
{
{
if
(
equal
(
grp
.
verts
[
i
],
pt
,
mWeldThresh
)
&&
if
(
equal
(
grp
.
verts
[
i
],
pt
,
mWeldThresh
)
&&
grp
.
uvs
[
i
].
u
==
uv
.
x
&&
grp
.
uvs
[
i
].
v
==
uv
.
y
&&
equal
(
grp
.
vnorms
[
i
],
norm
,
0
))
equal
(
grp
.
vnorms
[
i
],
norm
,
0
))
{
{
if
(
mesh
->
tvFace
&&
(
grp
.
uvs
[
i
].
u
!=
uv
.
x
||
grp
.
uvs
[
i
].
v
!=
uv
.
y
))
continue
;
if
(
mVertexColors
&&
mesh
->
vertCol
&&
if
(
mVertexColors
&&
mesh
->
vertCol
&&
(
grp
.
vcolors
[
i
].
r
!=
col
.
x
||
(
grp
.
vcolors
[
i
].
r
!=
col
.
x
||
grp
.
vcolors
[
i
].
g
!=
col
.
y
||
grp
.
vcolors
[
i
].
g
!=
col
.
y
||
...
@@ -144,9 +149,11 @@ int Exporter::addVertex(FaceGroup &grp, int face, int vi, Mesh *mesh, const Matr
...
@@ -144,9 +149,11 @@ int Exporter::addVertex(FaceGroup &grp, int face, int vi, Mesh *mesh, const Matr
}
}
grp
.
verts
.
push_back
(
Vector3
(
pt
.
x
,
pt
.
y
,
pt
.
z
));
grp
.
verts
.
push_back
(
Vector3
(
pt
.
x
,
pt
.
y
,
pt
.
z
));
grp
.
uvs
.
push_back
(
TexCoord
(
uv
.
x
,
uv
.
y
));
grp
.
vnorms
.
push_back
(
Vector3
(
norm
.
x
,
norm
.
y
,
norm
.
z
));
grp
.
vnorms
.
push_back
(
Vector3
(
norm
.
x
,
norm
.
y
,
norm
.
z
));
if
(
mesh
->
tvFace
)
grp
.
uvs
.
push_back
(
TexCoord
(
uv
.
x
,
uv
.
y
));
if
(
mVertexColors
&&
mesh
->
vertCol
)
if
(
mVertexColors
&&
mesh
->
vertCol
)
grp
.
vcolors
.
push_back
(
Color4
(
col
.
x
,
col
.
y
,
col
.
z
,
1
));
grp
.
vcolors
.
push_back
(
Color4
(
col
.
x
,
col
.
y
,
col
.
z
,
1
));
...
@@ -158,11 +165,12 @@ void Exporter::addFace(FaceGroup &grp, int face, const int vi[3], Mesh *mesh, co
...
@@ -158,11 +165,12 @@ void Exporter::addFace(FaceGroup &grp, int face, const int vi[3], Mesh *mesh, co
Triangle
tri
;
Triangle
tri
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
{
DWORD
t0
=
mesh
->
tvFace
[
face
].
getTVert
(
0
);
/*
DWORD t0 = mesh->tvFace[ face ].getTVert(0);
DWORD t1 = mesh->tvFace[ face ].getTVert(1);
DWORD t1 = mesh->tvFace[ face ].getTVert(1);
DWORD t2 = mesh->tvFace[ face ].getTVert(2);
DWORD t2 = mesh->tvFace[ face ].getTVert(2);
int dir = mesh->tvFace[ face ].Direction(t0, t1);
int dir = mesh->tvFace[ face ].Direction(t0, t1);
*/
/* Point3 tv = mesh->verts[ mesh->faces[ face ].v[ vi[i] ] ]; // * tm;
/* Point3 tv = mesh->verts[ mesh->faces[ face ].v[ vi[i] ] ]; // * tm;
tri[i] = addVertex(grp,
tri[i] = addVertex(grp,
...
...
This diff is collapsed.
Click to expand it.
NifExport/NifExport.cpp
+
1
−
1
View file @
cd6693d1
...
@@ -153,7 +153,7 @@ int NifExport::ExtCount()
...
@@ -153,7 +153,7 @@ int NifExport::ExtCount()
const
TCHAR
*
NifExport
::
Ext
(
int
n
)
const
TCHAR
*
NifExport
::
Ext
(
int
n
)
{
{
return
_T
(
"
f
if"
);
return
_T
(
"
n
if"
);
}
}
const
TCHAR
*
NifExport
::
LongDesc
()
const
TCHAR
*
NifExport
::
LongDesc
()
...
...
This diff is collapsed.
Click to expand it.
NifExport/Strips.cpp
+
48
−
35
View file @
cd6693d1
...
@@ -18,47 +18,59 @@ void Exporter::strippify(TriStrips &strips, vector<Vector3> &verts, vector<Vecto
...
@@ -18,47 +18,59 @@ void Exporter::strippify(TriStrips &strips, vector<Vector3> &verts, vector<Vecto
tri_stripper
::
primitives_vector
groups
;
tri_stripper
::
primitives_vector
groups
;
stripper
.
Strip
(
&
groups
);
stripper
.
Strip
(
&
groups
);
// triangles left over
Triangles
stris
;
for
(
i
=
0
;
i
<
groups
.
size
();
i
++
)
for
(
i
=
0
;
i
<
groups
.
size
();
i
++
)
{
{
if
(
groups
[
i
].
m_Type
!=
tri_stripper
::
PT_Triangle_Strip
)
if
(
groups
[
i
].
m_Type
==
tri_stripper
::
PT_Triangle_Strip
)
continue
;
{
strips
.
push_back
(
TriStrip
(
groups
[
i
].
m_Indices
.
size
()));
strips
.
push_back
(
TriStrip
(
groups
[
i
].
m_Indices
.
size
()));
TriStrip
&
strip
=
strips
.
back
();
TriStrip
&
strip
=
strips
.
back
();
for
(
int
j
=
0
;
j
<
groups
[
i
].
m_Indices
.
size
();
j
++
)
for
(
int
j
=
0
;
j
<
groups
[
i
].
m_Indices
.
size
();
j
++
)
strip
[
j
]
=
groups
[
i
].
m_Indices
[
j
];
strip
[
j
]
=
groups
[
i
].
m_Indices
[
j
];
}
else
{
int
size
=
stris
.
size
();
stris
.
resize
(
size
+
groups
[
i
].
m_Indices
.
size
()
/
3
);
for
(
int
j
=
(
size
>
0
)
?
(
size
-
1
)
:
0
;
j
<
stris
.
size
();
j
++
)
{
stris
[
j
][
0
]
=
groups
[
i
].
m_Indices
[
j
*
3
+
0
];
stris
[
j
][
1
]
=
groups
[
i
].
m_Indices
[
j
*
3
+
1
];
stris
[
j
][
2
]
=
groups
[
i
].
m_Indices
[
j
*
3
+
2
];
}
}
}
}
}
void
Exporter
::
strippify
(
TriStrips
&
strips
,
FaceGroup
&
grp
)
if
(
stris
.
size
())
{
/* vector<unsigned int> idcs(grp.faces.size()*3);
int i;
for (i=0; i<grp.faces.size(); i++)
{
{
idcs[i * 3 + 0] = grp.faces[i][0];
// stitch em
idcs[i * 3 + 1] = grp.faces[i][1];
TriStrip
strip
;
idcs[i * 3 + 2] = grp.faces[i][2];
if
(
strips
.
size
()
>
0
)
}
{
strip
.
push_back
(
strips
.
back
()[
strips
.
back
().
size
()
-
1
]);
tri_stripper stripper(idcs);
strip
.
push_back
(
stris
[
0
][
0
]);
}
tri_stripper::primitives_vector groups;
for
(
i
=
0
;
i
<
stris
.
size
();
i
++
)
stripper.Strip(&groups);
{
if
(
i
>
0
)
{
strip
.
push_back
(
stris
[
i
][
0
]);
strip
.
push_back
(
stris
[
i
][
0
]);
}
for (i=0; i<groups.size(); i++)
strip
.
push_back
(
stris
[
i
][
0
]);
{
strip
.
push_back
(
stris
[
i
][
1
]);
if (groups[i].m_Type != tri_stripper::PT_Triangle_Strip)
strip
.
push_back
(
stris
[
i
][
2
]);
continue;
if
(
i
<
stris
.
size
()
-
1
)
strip
.
push_back
(
stris
[
i
][
2
]);
strips.push_back(TriStrip(groups[i].m_Indices.size()));
}
TriStrip &strip = strips.back();
strips
.
push_back
(
strip
);
for (int j=0; j<groups[i].m_Indices.size(); j++)
strip[j] = groups[i].m_Indices[j];
}
}
*/
}
void
Exporter
::
strippify
(
TriStrips
&
strips
,
FaceGroup
&
grp
)
{
unsigned
short
*
data
=
(
unsigned
short
*
)
malloc
(
grp
.
faces
.
size
()
*
3
*
2
);
unsigned
short
*
data
=
(
unsigned
short
*
)
malloc
(
grp
.
faces
.
size
()
*
3
*
2
);
int
i
;
int
i
;
...
@@ -119,7 +131,8 @@ void Exporter::strippify(TriStrips &strips, FaceGroup &grp)
...
@@ -119,7 +131,8 @@ void Exporter::strippify(TriStrips &strips, FaceGroup &grp)
grp
.
verts
[
a
]
=
tmp
.
verts
[
b
];
grp
.
verts
[
a
]
=
tmp
.
verts
[
b
];
grp
.
vnorms
[
a
]
=
tmp
.
vnorms
[
b
];
grp
.
vnorms
[
a
]
=
tmp
.
vnorms
[
b
];
grp
.
uvs
[
a
]
=
tmp
.
uvs
[
b
];
if
(
grp
.
uvs
.
size
()
>
0
)
grp
.
uvs
[
a
]
=
tmp
.
uvs
[
b
];
if
(
grp
.
vcolors
.
size
()
>
0
)
if
(
grp
.
vcolors
.
size
()
>
0
)
grp
.
vcolors
[
a
]
=
tmp
.
vcolors
[
b
];
grp
.
vcolors
[
a
]
=
tmp
.
vcolors
[
b
];
}
}
...
...
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