bool QuaternionValidate(Handle<Object>& src) { return ( src->Has(JS_STRING(x)) && NumericValidate(src->Get(JS_STRING(x))) && src->Has(JS_STRING(y)) && NumericValidate(src->Get(JS_STRING(y))) && src->Has(JS_STRING(z)) && NumericValidate(src->Get(JS_STRING(z))) && src->Has(JS_STRING(w)) && NumericValidate(src->Get(JS_STRING(w))) ); }
bool decodeBoundingSphere3f(v8::Handle<v8::Value> toDecodeCenterVec, v8::Handle<v8::Value> toDecodeRadius, BoundingSphere3f& toDecodeTo, String& errMsg) { bool isVec3 = Vec3ValValidate(toDecodeCenterVec); if (! isVec3) { errMsg += "Error decoding bounding sphere. Position argument passed in for center of sphere is not a vec3."; return false; } Vector3f centerPos = Vec3ValExtractF(toDecodeCenterVec); bool isNumber = NumericValidate(toDecodeRadius); if (! isNumber) { errMsg += "Error decoding bounding sphere. Radius argument passed in is not a number. "; return false; } double rad = NumericExtract(toDecodeRadius); toDecodeTo = BoundingSphere3f(centerPos, rad); return true; }
bool decodeSolidAngle(v8::Handle<v8::Value> toDecode, SolidAngle& toDecodeTo, String& errMsg) { if (!NumericValidate(toDecode)) { errMsg += " Error decoding solid angle. Passed in parameter was not of numeric type"; return false; } toDecodeTo = SolidAngle(NumericExtract(toDecode)); return true; }