void VJSLanguageSyntaxTesterDefinitionResults::_GetResult( VJSParms_callStaticFunction &ioParams, IJSLanguageSyntaxTesterDefinitionResults *inResults )
{
	if (inResults) {
		sLONG index;
		if (ioParams.GetLongParam( 1, &index ))
		{
			IDefinition definition = inResults->GetResult( index );
			VJSObject	result(ioParams.GetContextRef());
			VJSValue	jsval(ioParams.GetContextRef());

			result.MakeEmpty();

			jsval.SetString( definition.GetName() );
			result.SetProperty(L"name", jsval, JS4D::PropertyAttributeNone);

			jsval.SetString( definition.GetFilePath() );
			result.SetProperty(L"file", jsval, JS4D::PropertyAttributeNone);

			jsval.SetNumber( definition.GetLineNumber() + 1 );
			result.SetProperty(L"line", jsval, JS4D::PropertyAttributeNone);

			ioParams.ReturnValue(result);
		}
	}
}
Exemplo n.º 2
0
G3D::Matrix4 Utils::GetTransformation(IDefinition def)
{
    G3D::Matrix4 translation;
    if (def.Position.x == 0.0f && def.Position.y == 0.0f && def.Position.z == 0.0f)
        translation = G3D::Matrix4::identity();
    else
        translation = G3D::Matrix4::translation(-(def.Position.z - Constants::MaxXY),
            -(def.Position.x - Constants::MaxXY), def.Position.y);

    G3D::Matrix4 rotation = RotationX(ToRadians(def.Rotation.z)) * RotationY(ToRadians(def.Rotation.x)) * RotationZ(ToRadians(def.Rotation.y + 180));
    if (def.Scale() < 1.0f || def.Scale() > 1.0f)
        return G3D::Matrix4::scale(def.Scale()) * rotation * translation;
    return rotation * translation;
}
Exemplo n.º 3
0
Vector3 TransformDoodadVertex(const IDefinition& def, Vector3& vec)
{
    float mapOffset = 17066.0f + (2 / 3.0f);
    Vector3 MapPos = Vector3(mapOffset, 0, mapOffset);
    G3D::Matrix4 rot = G3D::Matrix4::identity();
    rot = rot.pitchDegrees(def.Rotation.y - 90);
    rot = rot.yawDegrees(-def.Rotation.x);
    rot = rot.rollDegrees(def.Rotation.z - 90);

    Vector3 offset = def.Position - MapPos;

    // Because homoMul wants a G3D::Vector3
    G3D::Vector3 g3dvec(vec.x, vec.y, vec.z);
    G3D::Vector3 g3dOffset(offset.x, offset.y, offset.z);
    G3D::Vector3 ret = (rot.homoMul(g3dvec, 1)  * def.Scale()) + g3dOffset;
    Vector3 ret2 = (Utils::VectorTransform(vec, rot) + def.Position - MapPos) * def.Scale();
    return ret2; //Vector3(ret.x, ret.y, ret.z);
}
Exemplo n.º 4
0
Vector3 Utils::TransformDoodadVertex(const IDefinition& def, Vector3 vec, bool translate)
{
    // Sources of information:
    /// http://www.pxr.dk/wowdev/wiki/index.php?title=ADT/v18&oldid=3715

    // This function applies to both external doodads and WMOs

    // Rotate our Doodad vertex
    G3D::Matrix4 rot = G3D::Matrix3::fromEulerAnglesXYZ(Utils::ToRadians(def.Rotation.z), Utils::ToRadians(-def.Rotation.x), Utils::ToRadians(def.Rotation.y + 180));
    Vector3 ret = Utils::VectorTransform(vec, rot);

    // And finally scale and translate it to our origin
    ret = ret * def.Scale();
    if (translate)
        ret = ret + Vector3(Constants::MaxXY - def.Position.z, Constants::MaxXY - def.Position.x, def.Position.y);
    return ret;
}