saveCache method
void
saveCache(
- dynamic object,
- BufferGeometry geometry,
- WebGLProgram program,
- BufferAttribute<
NativeArray< ? index,num> >
Implementation
void saveCache(object, BufferGeometry geometry, WebGLProgram program, BufferAttribute? index) {
var cache = {};
var attributes = geometry.attributes;
var attributesNum = 0;
var programAttributes = program.getAttributes();
for ( final name in programAttributes.keys ) {
Map programAttribute = programAttributes[ name ];
if ( programAttribute["location"] >= 0 ) {
var attribute = attributes[ name ];
if ( attribute == undefined ) {
if ( name == 'instanceMatrix' && object.instanceMatrix != null) attribute = object.instanceMatrix;
if ( name == 'instanceColor' && object.instanceColor != null) attribute = object.instanceColor;
}
var data = {};
data["attribute"] = attribute;
if ( attribute != null && attribute.data != null ) {
data["data"] = attribute.data;
}
cache[ name ] = data;
attributesNum ++;
}
}
currentState["attributes"] = cache;
currentState["attributesNum"] = attributesNum;
currentState["index"] = index;
}