Exemplo n.º 1
0
Quaternion QuaternionExtract(Handle<Object>& src) {
    Quaternion result(
        NumericExtract( src->Get(JS_STRING(x)) ),
        NumericExtract( src->Get(JS_STRING(y)) ),
        NumericExtract( src->Get(JS_STRING(z)) ),
        NumericExtract( src->Get(JS_STRING(w)) ),
        Quaternion::XYZW()
    );
    return result;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}