ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/normcodec.c
(Generate patch)

Comparing ray/src/common/normcodec.c (file contents):
Revision 2.3 by greg, Wed Aug 14 21:00:14 2019 UTC vs.
Revision 2.4 by greg, Mon Aug 26 23:33:24 2019 UTC

# Line 125 | Line 125 | check_decode_normals(NORMCODEC *ncp)
125   int
126   decode_normal_next(FVECT nrm, NORMCODEC *ncp)
127   {
128 +        int32   lastc;
129 +        FVECT   lastv;
130          int32   c = getint(4, ncp->finp);
131  
132          if (c == EOF && feof(ncp->finp))
# Line 132 | Line 134 | decode_normal_next(FVECT nrm, NORMCODEC *ncp)
134  
135          ncp->curpos += 4;
136  
137 <        decodedir(nrm, c);
138 <
137 >        if (c == lastc) {                       /* optimization */
138 >                VCOPY(nrm, lastv);
139 >        } else {
140 >                decodedir(nrm, c);
141 >                if (c) {
142 >                        lastc = c;
143 >                        VCOPY(lastv, nrm);
144 >                }
145 >        }
146          return (c != 0);
147   }
148  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines