Added row file access ....

This commit is contained in:
Federico Ponchio 2004-10-19 16:50:27 +00:00
parent e787398065
commit 65814f4a2b
2 changed files with 26 additions and 4 deletions

View File

@ -39,6 +39,7 @@ void nxs::ComputeNormals(Nexus &nexus) {
tmpb.Resize(tmpb_offset);
for(unsigned int i = 0; i < tmpb.Size(); i++)
tmpb[i] = zero;
tmpb.Flush();
//first step normals in the same patch.
for(unsigned int p = 0; p < nexus.index.size(); p++) {
@ -96,7 +97,10 @@ void nxs::ComputeNormals(Nexus &nexus) {
Link &link = border[i];
if(link.IsNull()) continue;
unsigned int off = tmpb_start[p];
tmpb[off + i] += normals[link.start_vert];
Point3f p = tmpb.read(off + i);
p += normals[link.start_vert];
tmpb.write(off + i, p);
// tmpb[off + i] += normals[link.start_vert];
close.insert(link.end_patch);
}
@ -109,7 +113,10 @@ void nxs::ComputeNormals(Nexus &nexus) {
Link &link = remote[i];
if(link.IsNull()) continue;
if(link.end_patch != p) continue;
tmpb[off + i] += normals[link.end_vert];
Point3f p = tmpb.read(off + i);
p += normals[link.end_vert];
tmpb.write(off + i, p);
// tmpb[off + i] += normals[link.end_vert];
}
}
}
@ -123,7 +130,8 @@ void nxs::ComputeNormals(Nexus &nexus) {
Link &link = border[i];
if(link.IsNull()) continue;
unsigned int off = tmpb_start[p];
Point3f &n = tmpb[off + i];
// Point3f &n = tmpb[off + i];
Point3f n = tmpb.read(off + i);
n.Normalize();
if(use_short) {
n *= 32766;

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.13 2004/10/08 15:12:04 ponchio
Working version (maybe)
Revision 1.12 2004/10/04 16:49:54 ponchio
Daily backup. Preparing for compression.
@ -256,7 +259,18 @@ template <class T> class VFile: public File {
SetPosition(chunk * chunk_size * sizeof(T));
ReadBuffer((char *)(buffer.data), buffer.size * sizeof(T));
return buffer.data;
}
}
//non buffered read only acces.
T read(unsigned int element) {
SetPosition(element * sizeof(T));
T t;
ReadBuffer(&t, sizeof(T));
return t;
}
void write(unsigned int element, T &t) {
SetPosition(element * sizeof(T));
WriteBuffer(&t, sizeof(T));
}
void PushBack(const T &t) {
Resize(n_elements+1);