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
029290cd
Commit
029290cd
authored
18 years ago
by
Gundalf
Browse files
Options
Downloads
Patches
Plain Diff
Vertex Colors
parent
25d8fd35
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/Config.cpp
+2
-2
2 additions, 2 deletions
NifExport/Config.cpp
NifExport/Exporter.h
+1
-1
1 addition, 1 deletion
NifExport/Exporter.h
NifExport/Mesh.cpp
+26
-2
26 additions, 2 deletions
NifExport/Mesh.cpp
NifExport/NifExport.rc
+1
-1
1 addition, 1 deletion
NifExport/NifExport.rc
with
30 additions
and
6 deletions
NifExport/Config.cpp
+
2
−
2
View file @
029290cd
...
...
@@ -29,7 +29,7 @@ void Exporter::writeConfig()
regSet
(
hKey
,
"npx_furn"
,
mExportFurn
);
regSet
(
hKey
,
"npx_lights"
,
mExportLights
);
regSet
(
hKey
,
"npx_vcolors"
,
mVertexColors
);
regSet
(
hKey
,
"npx_wthresh"
,
mWeldThresh
);
//
regSet(hKey, "npx_wthresh", mWeldThresh);
regSet
(
hKey
,
"npx_tprefix"
,
mTexPrefix
);
regSet
(
hKey
,
"npx_coll"
,
mExportCollision
);
}
...
...
@@ -52,7 +52,7 @@ void Exporter::readConfig()
regGet
(
hKey
,
"npx_furn"
,
mExportFurn
);
regGet
(
hKey
,
"npx_lights"
,
mExportLights
);
regGet
(
hKey
,
"npx_vcolors"
,
mVertexColors
);
regGet
(
hKey
,
"npx_wthresh"
,
mWeldThresh
);
//
regGet(hKey, "npx_wthresh", mWeldThresh);
regGet
(
hKey
,
"npx_tprefix"
,
mTexPrefix
);
regGet
(
hKey
,
"npx_coll"
,
mExportCollision
);
}
...
...
This diff is collapsed.
Click to expand it.
NifExport/Exporter.h
+
1
−
1
View file @
029290cd
...
...
@@ -90,7 +90,7 @@ private:
/* mesh export */
// adds a vertex to a face group if it doesn't exist yet. returns new or previous index into the
// vertex array.
int
addVertex
(
FaceGroup
&
grp
,
const
Point3
&
pt
,
const
Point3
&
uv
,
const
Point3
&
norm
);
int
addVertex
(
FaceGroup
&
grp
,
int
face
,
int
vi
,
Mesh
*
mesh
);
// adds a face to a face group
void
addFace
(
FaceGroup
&
grp
,
int
face
,
const
int
vi
[
3
],
Mesh
*
mesh
);
// returns true if at least one of the colors in the group has a value != (1, 1, 1, 1)
...
...
This diff is collapsed.
Click to expand it.
NifExport/Mesh.cpp
+
26
−
2
View file @
029290cd
...
...
@@ -97,6 +97,9 @@ bool Exporter::makeMesh(NiNodeRef &parent, Mtl *mtl, FaceGroup &grp)
data
->
SetUVSetCount
(
1
);
data
->
SetUVSet
(
0
,
grp
.
uvs
);
if
(
grp
.
vcolors
.
size
()
>
0
)
data
->
SetVertexColors
(
grp
.
vcolors
);
shape
->
SetData
(
data
);
NiAVObjectRef
av
(
DynamicCast
<
NiAVObject
>
(
shape
));
...
...
@@ -108,20 +111,39 @@ bool Exporter::makeMesh(NiNodeRef &parent, Mtl *mtl, FaceGroup &grp)
return
true
;
}
int
Exporter
::
addVertex
(
FaceGroup
&
grp
,
const
Point3
&
pt
,
const
Point3
&
uv
,
const
Point3
&
norm
)
int
Exporter
::
addVertex
(
FaceGroup
&
grp
,
int
face
,
int
vi
,
Mesh
*
mesh
)
{
Point3
pt
=
mesh
->
verts
[
mesh
->
faces
[
face
].
v
[
vi
]
];
Point3
uv
=
mesh
->
tVerts
[
mesh
->
tvFace
[
face
].
t
[
vi
]];
Point3
norm
=
getVertexNormal
(
mesh
,
face
,
mesh
->
getRVertPtr
(
mesh
->
faces
[
face
].
v
[
vi
]));
VertColor
col
;
if
(
mVertexColors
&&
mesh
->
vertCol
)
col
=
mesh
->
vertCol
[
mesh
->
vcFace
[
face
].
t
[
vi
]
];
for
(
int
i
=
0
;
i
<
grp
.
verts
.
size
();
i
++
)
{
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
))
{
if
(
mVertexColors
&&
mesh
->
vertCol
&&
(
grp
.
vcolors
[
i
].
r
!=
col
.
x
||
grp
.
vcolors
[
i
].
g
!=
col
.
y
||
grp
.
vcolors
[
i
].
b
!=
col
.
z
))
continue
;
return
i
;
}
}
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
));
if
(
mVertexColors
&&
mesh
->
vertCol
)
grp
.
vcolors
.
push_back
(
Color4
(
col
.
x
,
col
.
y
,
col
.
z
,
1
));
return
grp
.
verts
.
size
()
-
1
;
}
...
...
@@ -130,11 +152,13 @@ void Exporter::addFace(FaceGroup &grp, int face, const int vi[3], Mesh *mesh)
Triangle
tri
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
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,
tv,
mesh->tVerts[ mesh->tvFace[ face ].t[ vi[i] ]],
getVertexNormal(mesh, face, mesh->getRVertPtr(mesh->faces[ face ].v[ vi[i] ])));
*/
tri
[
i
]
=
addVertex
(
grp
,
face
,
vi
[
i
],
mesh
);
}
grp
.
faces
.
push_back
(
tri
);
...
...
This diff is collapsed.
Click to expand it.
NifExport/NifExport.rc
+
1
−
1
View file @
029290cd
...
...
@@ -102,7 +102,7 @@ BEGIN
CONTROL "Export Co&llision",IDC_CHK_COLL,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,85,18,68,10
CONTROL "&Vertex Colors",IDC_CHK_VCOLORS,"Button",
BS_AUTOCHECKBOX |
WS_DISABLED |
WS_TABSTOP,85,31,68,10
BS_AUTOCHECKBOX | WS_TABSTOP,85,31,68,10
LTEXT "http://niftools.sourceforge.net",IDC_LBL_LINK,98,87,95,
14,SS_NOTIFY | SS_CENTERIMAGE
END
...
...
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