0001 function Srf=vb_ScriptLoadSRF(infile)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 Srf.filename=infile;
0016 if ~exist(infile)
0017 error(sprintf('file %s not fount',infile));
0018 end
0019
0020 fid=fopen(infile,'r','ieee-le');
0021 Srf.Version=fread(fid,1,'float32');
0022 fread(fid,1,'int32');
0023 Srf.NrOfVertices=fread(fid,1,'int32');
0024 Srf.NrOfTriangles=fread(fid,1,'int32');
0025 Srf.MeshCenterX=fread(fid,1,'float32');
0026 Srf.MeshCenterY=fread(fid,1,'float32');
0027 Srf.MeshCenterZ=fread(fid,1,'float32');
0028 Srf.VertexX=fread(fid,Srf.NrOfVertices,'float32');
0029 Srf.VertexY=fread(fid,Srf.NrOfVertices,'float32');
0030 Srf.VertexZ=fread(fid,Srf.NrOfVertices,'float32');
0031 Srf.NormalX=fread(fid,Srf.NrOfVertices,'float32');
0032 Srf.NormalY=fread(fid,Srf.NrOfVertices,'float32');
0033 Srf.NormalZ=fread(fid,Srf.NrOfVertices,'float32');
0034 Srf.Colors=fread(fid,8,'float32');
0035 Srf.MeshColor=fread(fid,Srf.NrOfVertices,'int32');
0036 for i=1:Srf.NrOfVertices
0037 n=fread(fid,1,'int32');
0038 fread(fid,n,'int32')';
0039 end
0040 Srf.Triangles=fread(fid,[3 Srf.NrOfTriangles],'int32')';
0041 Srf.NrOfStripElements=fread(fid,1,'int32');
0042 if Srf.NrOfStripElements>0
0043 Srf.StripElements=fread(fid,Srf.NrOfStripElements,'int32')
0044 end
0045 fclose(fid);
0046
0047
0048