OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 87 matching lines...) Loading... |
98 return; | 98 return; |
99 } | 99 } |
100 | 100 |
101 stream.WriteByte(field_id); | 101 stream.WriteByte(field_id); |
102 stream.WriteByte(field.num_components()); | 102 stream.WriteByte(field.num_components()); |
103 } | 103 } |
104 | 104 |
105 // Write out the number of elements | 105 // Write out the number of elements |
106 stream.WriteLittleEndianUInt32(num_elements); | 106 stream.WriteLittleEndianUInt32(num_elements); |
107 | 107 |
108 // Make note of stream position at end of header | |
109 size_t data_start_position = stream.GetStreamPosition(); | |
110 | |
111 // Write out the data for each field | 108 // Write out the data for each field |
112 // Write out the specification for the fields | 109 // Write out the specification for the fields |
113 for (size_t i = 0; i < num_fields; ++i) { | 110 for (size_t i = 0; i < num_fields; ++i) { |
114 const Field &field = *buffer.fields()[i]; | 111 const Field &field = *buffer.fields()[i]; |
115 | 112 |
116 MemoryBuffer<uint8> field_data(field.size() * num_elements); | 113 MemoryBuffer<uint8> field_data(field.size() * num_elements); |
117 uint8 *destination = field_data; | 114 uint8 *destination = field_data; |
118 | 115 |
119 // Figure out what type of field it is, and get the data | 116 // Figure out what type of field it is, and get the data |
120 // appropriately | 117 // appropriately |
(...skipping 136 matching lines...) Loading... |
257 | 254 |
258 for (size_t j = 0; j < influence_count; ++j) { | 255 for (size_t j = 0; j < influence_count; ++j) { |
259 const Skin::Influence &influence = influences[j]; | 256 const Skin::Influence &influence = influences[j]; |
260 stream.WriteLittleEndianInt32(influence.matrix_index); | 257 stream.WriteLittleEndianInt32(influence.matrix_index); |
261 stream.WriteLittleEndianFloat32(influence.weight); | 258 stream.WriteLittleEndianFloat32(influence.weight); |
262 } | 259 } |
263 } | 260 } |
264 } | 261 } |
265 | 262 |
266 } // namespace o3d | 263 } // namespace o3d |
OLD | NEW |