void CTiglTransformation::AddRotationX(double degreeX) { double radianX = DegreeToRadian(degreeX); double sinVal = sin(radianX); double cosVal = cos(radianX); // Matrix is: // // ( 1 0 0 0 ) // ( 0 cosVal -sinVal 0 ) // ( 0 sinVal cosVal 0 ) // ( 0 0 0 1 ) CTiglTransformation trans; trans.SetValue(1, 1, cosVal); trans.SetValue(1, 2, -sinVal); trans.SetValue(2, 1, sinVal); trans.SetValue(2, 2, cosVal); PreMultiply(trans); }
/*计算金星摄动,木星摄动以及地球扁率摄动对月球地心黄纬的影响,dt 是儒略世纪数,Lp、Mp和F单位是度*/ double CalcMoonLatitudePerturbation(double dt, double Lp, double F, double Mp) { double T = dt; /*T是从J2000起算的儒略世纪数*/ double A1 = 119.75 + 131.849 * T; double A3 = 313.45 + 481266.484 * T; A1 = Mod360Degree(A1); A3 = Mod360Degree(A3); double result = -2235.0 * sin(DegreeToRadian(Lp)); result += (382.0 * sin(DegreeToRadian(A3))); result += (175.0 * sin(DegreeToRadian(A1 - F))); result += (175.0 * sin(DegreeToRadian(A1 + F))); result += (127.0 * sin(DegreeToRadian(Lp - Mp))); result += (115.0 * sin(DegreeToRadian(Lp + Mp))); return result; }
void Camera3::Update(double dt) { static const float CAMERA_SPEED = 100.f; prevPosition = position; Vector3 view = (target - position).Normalized(); Vector3 right = view.Cross(up); //if (Application::IsKeyPressed('Q') && mouseControl == false && delay2 == 0) //{ // mouseControl = true; // glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); // delay2 = 10; //} //else if (Application::IsKeyPressed('Q') && mouseControl == true && delay2 == 0) //{ // mouseControl = false; // glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_NORMAL); // delay2 = 10; //} /*if (delay2 > 0) { delay2--; }*/ Mtx44 rotation; if (mouseControl == true && Application::IsKeyPressed(VK_RBUTTON) && inBase == false) { xpos, ypos = a.Mouse(xpos, ypos); if (xpos < 399) { directionRotation.y += .5; } if (xpos > 401) { directionRotation.y -= .5; } if (ypos < 299) { if (directionRotation.x > -30) { directionRotation.x -= .5; } } if (ypos > 301) { if (directionRotation.x < 30) { directionRotation.x += .5; } } } else if (mouseControl == true) { xpos, ypos = a.Mouse(xpos, ypos); if (xpos < 399) { directionRotation.y += 2; } if (xpos > 401) { directionRotation.y -= 2; } if (ypos < 299) { if (directionRotation.x > -30) { directionRotation.x -= 2; } } if (ypos > 301) { if (directionRotation.x < 30) { directionRotation.x += 2; } } } else { if (Application::IsKeyPressed(VK_LEFT)) { directionRotation.y += 3; } if (Application::IsKeyPressed(VK_RIGHT)) { directionRotation.y -= 3; } if (Application::IsKeyPressed(VK_UP)) { if (directionRotation.x > -45) { directionRotation.x -= 3; } } if (Application::IsKeyPressed(VK_DOWN)) { if (directionRotation.x < 45) { directionRotation.x += 3; } } } if (recoil > 20) { recoil = 20; } gunRecoil.x = recoil; if (Application::IsKeyPressed(VK_LBUTTON)) { cRecoilCd = 20; } if (cRecoilCd > 0) { cRecoilCd--; } if (gunRecoil.x > 0 && cRecoilCd == 0) { gunRecoil.x -= 0.2; } if (recoil > 0 && cRecoilCd == 0) { recoil -= 0.2; } camerarotation = directionRotation - gunRecoil; if (stamina < 100 && staminaDelay == 0) { stamina++; } if (staminaDelay > 0) { staminaDelay--; } location2 = position + view*dt*speed; location = position; direction = (view*dt*speed) * 2; if (inBase == true || inMenu == true) { if (Application::IsKeyPressed('W')) { Vector3 view = (target - position).Normalized(); if (position.x + (view.x * dt * speed) / 2 <= 48 && position.x + (view.x * dt * speed) / 2 >= -48 && hitbox((position.x * dt * speed) / 2) == false && checkcollisionwithObject((view.x * dt * speed) / 2) == false) { position.x += (view.x * dt * speed) / 2; target.x += (view.x * dt * speed) / 2; } if (position.z + (view.z * dt * speed) / 2 <= 48 && position.z + (view.z * dt * speed) / 2 >= -48 && hitbox((view.z * dt * speed) / 2) == false && checkcollisionwithObject((view.z * dt * speed) / 2) == false) { position.z += (view.z * dt * speed) / 2; target.z += (view.z * dt * speed) / 2; } /*if (Application::IsKeyPressed(VK_SPACE) && position.y + (view.y * dt * speed) / 2 <= 48 && position.y + (view.y * dt * speed) / 2 >= 10 && hitbox((position.y * dt * speed) / 2) == false && checkcollisionwithObject((view.y * dt * speed) / 2) == false) { position.y += (view.y * dt * speed) / 2; target.y += (view.y * dt * speed) / 2; }*/ } if (Application::IsKeyPressed('S')) { Vector3 view = (target - position).Normalized(); if (position.x - (view.x * dt * speed) / 2 <= 48 && position.x - (view.x * dt * speed) / 2 >= -48 && hitbox(-(view.x * dt * speed) / 2) == false && checkcollisionwithObject(-(view.x * dt * speed) / 2) == false) { position.x -= (view.x * dt * speed) / 2; target.x -= (view.x * dt * speed) / 2; } if (position.z - (view.z * dt * speed) / 2 <= 48 && position.z - (view.z * dt * speed) / 2 >= -48 && hitbox(-(view.z * dt * speed) / 2) == false && checkcollisionwithObject(-(view.z * dt * speed) / 2) == false) { position.z -= (view.z * dt * speed) / 2; target.z -= (view.z * dt * speed) / 2; } /*if (Application::IsKeyPressed(VK_SPACE) && position.y - (view.y * dt * speed) / 2 <= 48 && position.y - (view.y * dt * speed) / 2 >= 10 && hitbox(-(view.y * dt * speed) / 2) == false && checkcollisionwithObject(-(view.y * dt * speed) / 2) == false) { position.y -= (view.y * dt * speed) / 2; target.y -= (view.y * dt * speed) / 2; }*/ } if (Application::IsKeyPressed('D')) { Vector3 view = (target - position).Normalized(); Vector3 right = view.Cross(up); if (position.x + (right.x * dt * speed) / 2 <= 48 && position.x + (right.x * dt * speed) / 2 >= -48 && hitbox((right.x * dt * speed) / 2) == false && checkcollisionwithObject((right.x * dt * speed) / 2) == false) { position.x += (right.x * dt * speed) / 2; target.x += (right.x * dt * speed) / 2; } if (position.z + (right.z * dt * speed) / 2 <= 48 && position.z + (right.z * dt * speed) / 2 >= -48 && hitbox((right.z * dt * speed) / 2) == false && checkcollisionwithObject((right.z * dt * speed) / 2) == false) { position.z += (right.z * dt * speed) / 2; target.z += (right.z * dt * speed) / 2; } if (position.y - (right.y * dt * speed) / 2 <= 48 && position.y - (right.y * dt * speed) / 2 >= -48 && hitbox(-(right.y * dt * speed) / 2) == false && checkcollisionwithObject((right.y * dt * speed) / 2) == false) { position.z -= (right.y * dt * speed) / 2; target.z -= (right.y * dt * speed) / 2; } } if (Application::IsKeyPressed('A')) { Vector3 view = (target - position).Normalized(); Vector3 right = view.Cross(up); if (position.x - (right.x * dt * speed) / 2 <= 48 && position.x - (right.x * dt * speed) / 2 >= -48 && hitbox(-(right.x * dt * speed) / 2) == false && checkcollisionwithObject(-(right.x * dt * speed) / 2) == false) { position.x -= (right.x * dt * speed) / 2; target.x -= (right.x * dt * speed) / 2; } if (position.z - (right.z * dt * speed) / 2 <= 48 && position.z - (right.z * dt * speed) / 2 >= -48 && hitbox(-(right.z * dt * speed) / 2) == false && checkcollisionwithObject(-(right.z * dt * speed) / 2) == false) { position.z -= (right.z * dt * speed) / 2; target.z -= (right.z * dt * speed) / 2; } if (position.y - (right.y * dt * speed) / 2 <= 48 && position.y - (right.y * dt * speed) / 2 >= -48 && hitbox(-(right.y * dt * speed) / 2) == false && checkcollisionwithObject((right.y * dt * speed) / 2) == false) { position.z -= (right.y * dt * speed) / 2; target.z -= (right.y * dt * speed) / 2; } } } else if (inBase == false) { if (Application::IsKeyPressed(VK_RBUTTON) && scopedWep == true) { if (Application::IsKeyPressed('W')) { Vector3 view = (target - position).Normalized(); if (position.x + (view.x * dt * speed) / 5 <= 990 && position.x + (view.x * dt * speed) / 5 >= -990 && hitbox((position.x * dt * speed) / 5) == false && checkcollisionwithObject((view.x * dt * speed) / 5) == false) { position.x += (view.x * dt * speed) / 5; target.x += (view.x * dt * speed) / 5; } if (position.z + (view.z * dt * speed) / 5 <= 990 && position.z + (view.z * dt * speed) / 5 >= -990 && hitbox((view.z * dt * speed) / 5) == false && checkcollisionwithObject((view.z * dt * speed) / 5) == false) { position.z += (view.z * dt * speed) / 5; target.z += (view.z * dt * speed) / 5; } /*if (Application::IsKeyPressed(VK_SPACE) && position.y + (view.y * dt * speed) / 5 <= 990 && position.y + (view.y * dt * speed) / 5 >= 10 && hitbox((position.y * dt * speed) / 5) == false && checkcollisionwithObject((view.y * dt * speed) / 5) == false && stamina > 0) { position.y += (view.y * dt * speed) / 5; target.y += (view.y * dt * speed) / 5; stamina--; staminaDelay = 100; }*/ } if (Application::IsKeyPressed('S')) { Vector3 view = (target - position).Normalized(); if (position.x - (view.x * dt * speed) / 5 <= 990 && position.x - (view.x * dt * speed) / 5 >= -990 && hitbox(-(view.x * dt * speed) / 5) == false && checkcollisionwithObject(-(view.x * dt * speed) / 5) == false) { position.x -= (view.x * dt * speed) / 5; target.x -= (view.x * dt * speed) / 5; } if (position.z - (view.z * dt * speed) / 5 <= 990 && position.z - (view.z * dt * speed) / 5 >= -990 && hitbox(-(view.z * dt * speed) / 5) == false && checkcollisionwithObject(-(view.z * dt * speed) / 5) == false) { position.z -= (view.z * dt * speed) / 5; target.z -= (view.z * dt * speed) / 5; } /*if (Application::IsKeyPressed(VK_SPACE) && position.y - (view.y * dt * speed) / 5 <= 990 && position.y - (view.y * dt * speed) / 5 >= 10 && hitbox(-(view.y * dt * speed) / 5) == false && checkcollisionwithObject(-(view.y * dt * speed) / 5) == false && stamina > 0) { position.y -= (view.y * dt * speed) / 5; target.y -= (view.y * dt * speed) / 5; stamina--; staminaDelay = 100; }*/ } if (Application::IsKeyPressed('D')) { Vector3 view = (target - position).Normalized(); Vector3 right = view.Cross(up); if (position.x + (right.x * dt * speed) / 5 <= 990 && position.x + (right.x * dt * speed) / 5 >= -990 && hitbox((right.x * dt * speed) / 5) == false && checkcollisionwithObject((right.x * dt * speed) / 5) == false) { position.x += (right.x * dt * speed) / 5; target.x += (right.x * dt * speed) / 5; } if (position.z + (right.z * dt * speed) / 5 <= 990 && position.z + (right.z * dt * speed) / 5 >= -990 && hitbox((right.z * dt * speed) / 5) == false && checkcollisionwithObject((right.z * dt * speed) / 5) == false) { position.z += (right.z * dt * speed) / 5; target.z += (right.z * dt * speed) / 5; } if (position.y - (right.y * dt * speed) / 5 <= 990 && position.y - (right.y * dt * speed) / 5 >= -990 && hitbox(-(right.y * dt * speed) / 5) == false && checkcollisionwithObject((right.y * dt * speed) / 5) == false) { position.z -= (right.y * dt * speed) / 5; target.z -= (right.y * dt * speed) / 5; } } if (Application::IsKeyPressed('A')) { Vector3 view = (target - position).Normalized(); Vector3 right = view.Cross(up); if (position.x - (right.x * dt * speed) / 5 <= 990 && position.x - (right.x * dt * speed) / 5 >= -990 && hitbox(-(right.x * dt * speed) / 5) == false && checkcollisionwithObject(-(right.x * dt * speed) / 5) == false) { position.x -= (right.x * dt * speed) / 5; target.x -= (right.x * dt * speed) / 5; } if (position.z - (right.z * dt * speed) / 5 <= 990 && position.z - (right.z * dt * speed) / 5 >= -990 && hitbox(-(right.z * dt * speed) / 5) == false && checkcollisionwithObject(-(right.z * dt * speed) / 5) == false) { position.z -= (right.z * dt * speed) / 5; target.z -= (right.z * dt * speed) / 5; } if (position.y - (right.y * dt * speed) / 5 <= 990 && position.y - (right.y * dt * speed) / 5 >= -990 && hitbox(-(right.y * dt * speed) / 5) == false && checkcollisionwithObject(-(right.y * dt * speed) / 5) == false) { position.z -= (right.y * dt * speed) / 5; target.z -= (right.y * dt * speed) / 5; } } } else if (Application::IsKeyPressed(VK_SHIFT) && stamina > 0) { if (Application::IsKeyPressed('W')) { Vector3 view = (target - position).Normalized(); if (position.x + (view.x * dt * speed) <= 990 && position.x + (view.x * dt * speed) >= -990 && hitbox((position.x * dt * speed)) == false && checkcollisionwithObject((view.x * dt * speed)) == false) { position.x += (view.x * dt * speed); target.x += (view.x * dt * speed); } if (position.z + (view.z * dt * speed) <= 990 && position.z + (view.z * dt * speed) >= -990 && hitbox((view.z * dt * speed)) == false && checkcollisionwithObject((view.z * dt * speed)) == false) { position.z += (view.z * dt * speed); target.z += (view.z * dt * speed); } /*if (Application::IsKeyPressed(VK_SPACE) && position.y + (view.y * dt * speed) <= 990 && position.y + (view.y * dt * speed) >= 10 && hitbox((position.y * dt * speed)) == false && checkcollisionwithObject((view.y * dt * speed)) == false) { position.y += (view.y * dt * speed); target.y += (view.y * dt * speed); }*/ } if (Application::IsKeyPressed('S')) { Vector3 view = (target - position).Normalized(); if (position.x - (view.x * dt * speed) <= 990 && position.x - (view.x * dt * speed) >= -990 && hitbox(-(view.x * dt * speed)) == false && checkcollisionwithObject(-(view.x * dt * speed)) == false) { position.x -= (view.x * dt * speed); target.x -= (view.x * dt * speed); } if (position.z - (view.z * dt * speed) <= 990 && position.z - (view.z * dt * speed) >= -990 && hitbox(-(view.z * dt * speed)) == false && checkcollisionwithObject(-(view.z * dt * speed)) == false) { position.z -= (view.z * dt * speed); target.z -= (view.z * dt * speed); } /*if (Application::IsKeyPressed(VK_SPACE) && position.y - (view.y * dt * speed) <= 990 && position.y - (view.y * dt * speed) >= 10 && hitbox(-(view.y * dt * speed)) == false && checkcollisionwithObject(-(view.y * dt * speed)) == false) { position.y -= (view.y * dt * speed); target.y -= (view.y * dt * speed); }*/ } if (Application::IsKeyPressed('D')) { Vector3 view = (target - position).Normalized(); Vector3 right = view.Cross(up); if (position.x + (right.x * dt * speed) <= 990 && position.x + (right.x * dt * speed) >= -990 && hitbox((right.x * dt * speed)) == false && checkcollisionwithObject((right.x * dt * speed)) == false) { position.x += (right.x * dt * speed); target.x += (right.x * dt * speed); } if (position.z + (right.z * dt * speed) <= 990 && position.z + (right.z * dt * speed) >= -990 && hitbox((right.z * dt * speed)) == false && checkcollisionwithObject((right.z * dt * speed)) == false) { position.z += (right.z * dt * speed); target.z += (right.z * dt * speed); } if (position.y - (right.y * dt * speed) <= 990 && position.y - (right.y * dt * speed) >= -990 && hitbox(-(right.y * dt * speed)) == false && checkcollisionwithObject((right.y * dt * speed)) == false) { position.z -= (right.y * dt * speed); target.z -= (right.y * dt * speed); } } if (Application::IsKeyPressed('A')) { Vector3 view = (target - position).Normalized(); Vector3 right = view.Cross(up); if (position.x - (right.x * dt * speed) <= 990 && position.x - (right.x * dt * speed) >= -990 && hitbox(-(right.x * dt * speed)) == false && checkcollisionwithObject(-(right.x * dt * speed)) == false) { position.x -= (right.x * dt * speed); target.x -= (right.x * dt * speed); } if (position.z - (right.z * dt * speed) <= 990 && position.z - (right.z * dt * speed) >= -990 && hitbox(-(right.z * dt * speed)) == false && checkcollisionwithObject(-(right.z * dt * speed)) == false) { position.z -= (right.z * dt * speed); target.z -= (right.z * dt * speed); } if (position.y - (right.y * dt * speed) <= 990 && position.y - (right.y * dt * speed) >= -990 && hitbox(-(right.y * dt * speed)) == false && checkcollisionwithObject((right.y * dt * speed)) == false) { position.z -= (right.y * dt * speed); target.z -= (right.y * dt * speed); } } stamina--; staminaDelay = 100; } else { if (Application::IsKeyPressed('W')) { Vector3 view = (target - position).Normalized(); if (position.x + (view.x * dt * speed) / 2 <= 990 && position.x + (view.x * dt * speed) / 2 >= -990 && hitbox((position.x * dt * speed) / 2) == false && checkcollisionwithObject((view.x * dt * speed) / 2) == false) { position.x += (view.x * dt * speed) / 2; target.x += (view.x * dt * speed) / 2; } if (position.z + (view.z * dt * speed) / 2 <= 990 && position.z + (view.z * dt * speed) / 2 >= -990 && hitbox((view.z * dt * speed) / 2) == false && checkcollisionwithObject((view.z * dt * speed) / 2) == false) { position.z += (view.z * dt * speed) / 2; target.z += (view.z * dt * speed) / 2; } /*if (Application::IsKeyPressed(VK_SPACE) && position.y + (view.y * dt * speed) / 2 <= 990 && position.y + (view.y * dt * speed) / 2 >= 10 && hitbox((position.y * dt * speed) / 2) == false && checkcollisionwithObject((view.y * dt * speed) / 2) == false && stamina > 0) { position.y += (view.y * dt * speed) / 2; target.y += (view.y * dt * speed) / 2; stamina--; staminaDelay = 100; }*/ } if (Application::IsKeyPressed('S')) { Vector3 view = (target - position).Normalized(); if (position.x - (view.x * dt * speed) / 2 <= 990 && position.x - (view.x * dt * speed) / 2 >= -990 && hitbox(-(view.x * dt * speed) / 2) == false && checkcollisionwithObject(-(view.x * dt * speed) / 2) == false) { position.x -= (view.x * dt * speed) / 2; target.x -= (view.x * dt * speed) / 2; } if (position.z - (view.z * dt * speed) / 2 <= 990 && position.z - (view.z * dt * speed) / 2 >= -990 && hitbox(-(view.z * dt * speed) / 2) == false && checkcollisionwithObject(-(view.z * dt * speed) / 2) == false) { position.z -= (view.z * dt * speed) / 2; target.z -= (view.z * dt * speed) / 2; } /*if (Application::IsKeyPressed(VK_SPACE) && position.y - (view.y * dt * speed) / 2 <= 990 && position.y - (view.y * dt * speed) / 2 >= 10 && hitbox(-(view.y * dt * speed) / 2) == false && checkcollisionwithObject(-(view.y * dt * speed) / 2) == false && stamina > 0) { position.y -= (view.y * dt * speed) / 2; target.y -= (view.y * dt * speed) / 2; stamina--; staminaDelay = 100; }*/ } if (Application::IsKeyPressed('D')) { Vector3 view = (target - position).Normalized(); Vector3 right = view.Cross(up); if (position.x + (right.x * dt * speed) / 2 <= 990 && position.x + (right.x * dt * speed) / 2 >= -990 && hitbox((right.x * dt * speed) / 2) == false && checkcollisionwithObject((right.x * dt * speed) / 2) == false) { position.x += (right.x * dt * speed) / 2; target.x += (right.x * dt * speed) / 2; } if (position.z + (right.z * dt * speed) / 2 <= 990 && position.z + (right.z * dt * speed) / 2 >= -990 && hitbox((right.z * dt * speed) / 2) == false && checkcollisionwithObject((right.z * dt * speed) / 2) == false) { position.z += (right.z * dt * speed) / 2; target.z += (right.z * dt * speed) / 2; } if (position.y - (right.y * dt * speed) / 2 <= 990 && position.y - (right.y * dt * speed) / 2 >= -990 && hitbox(-(right.y * dt * speed) / 2) == false && checkcollisionwithObject((right.y * dt * speed) / 2) == false) { position.z -= (right.y * dt * speed) / 2; target.z -= (right.y * dt * speed) / 2; } } if (Application::IsKeyPressed('A')) { Vector3 view = (target - position).Normalized(); Vector3 right = view.Cross(up); if (position.x - (right.x * dt * speed) / 2 <= 990 && position.x - (right.x * dt * speed) / 2 >= -990 && hitbox(-(right.x * dt * speed) / 2) == false && checkcollisionwithObject(-(right.x * dt * speed) / 2) == false) { position.x -= (right.x * dt * speed) / 2; target.x -= (right.x * dt * speed) / 2; } if (position.z - (right.z * dt * speed) / 2 <= 990 && position.z - (right.z * dt * speed) / 2 >= -990 && hitbox(-(right.z * dt * speed) / 2) == false && checkcollisionwithObject(-(right.z * dt * speed) / 2) == false) { position.z -= (right.z * dt * speed) / 2; target.z -= (right.z * dt * speed) / 2; } if (position.y - (right.y * dt * speed) / 2 <= 990 && position.y - (right.y * dt * speed) / 2 >= -990 && hitbox(-(right.y * dt * speed) / 2) == false && checkcollisionwithObject((right.y * dt * speed) / 2) == false) { position.z -= (right.y * dt * speed) / 2; target.z -= (right.y * dt * speed) / 2; } } } } if (knockback == true) { knockback = false; if (position.x - (view.x * dt * speed)*10 <= 990 && position.x - (view.x * dt * speed)*10 >= -990 && hitbox(-(view.x * dt * speed)*10) == false && checkcollisionwithObject(-(view.x * dt * speed)*10) == false) { position.x -= (view.x * dt * speed) * 10; } if (position.z - (view.z * dt * speed) * 10 <= 990 && position.z - (view.z * dt * speed) * 10 >= -990 && hitbox(-(view.z * dt * speed) * 10) == false && checkcollisionwithObject(-(view.z * dt * speed) * 10) == false) { position.z -= (view.z * dt * speed) * 10; } } if (inMenu == false) { teleport(); } kb = (right * dt * speed); if (camerarotation.x > maxCameraX) { camerarotation.x = maxCameraX; } else if (camerarotation.x < -maxCameraX) { camerarotation.x = -maxCameraX; } std::cout << inMenu << std::endl; //Changing target target = Vector3(sin(DegreeToRadian(camerarotation.y))*cos(DegreeToRadian(camerarotation.x)) + this->position.x, -sin(DegreeToRadian(camerarotation.x)) + this->position.y, cos(DegreeToRadian(camerarotation.y))*cos(DegreeToRadian(camerarotation.x)) + this->position.z); }
bool ETHRenderEntity::DrawProjShadow(const float maxHeight, const float minHeight, const ETHSceneProperties& sceneProps, const ETHLight& light, ETHSpriteEntity *pParent, const bool maxOpacity, const bool drawToTarget, const float targetAngle, const Vector3& v3TargetPos) { if (!m_pSprite || IsHidden()) return false; VideoPtr video = m_provider->GetVideo(); ETHShaderManagerPtr shaderManager = m_provider->GetShaderManager(); SpritePtr pShadow = shaderManager->GetProjShadow(); Vector3 v3LightPos; Vector3 v3ParentPos(0,0,0); const Vector3 v3EntityPos = GetPosition(); if (pParent) { v3ParentPos = pParent->GetPosition(); v3LightPos = Vector3(v3ParentPos.x, v3ParentPos.y, 0) + light.pos; } else { v3LightPos = light.pos; } // if the object is higher than the light, then the shadow shouldn't be cast on the floor if (v3LightPos.z < v3EntityPos.z) { return true; } const float scale = (m_properties.shadowScale <= 0.0f) ? 1.0f : m_properties.shadowScale; const float opacity = (m_properties.shadowOpacity <= 0.0f) ? 1.0f : m_properties.shadowOpacity; const Vector2 v2Size = GetCurrentSize(); Vector2 v2ShadowSize(v2Size.x, v2Size.y); Vector2 v2ShadowPos(v3EntityPos.x, v3EntityPos.y); // if we are drawing to a target of a rotated entity if (drawToTarget && targetAngle != 0) { // rotate the shadow position according to entity angle Matrix4x4 matRot = RotateZ(-DegreeToRadian(targetAngle)); Vector3 newShadowPos(v2ShadowPos, 0); newShadowPos = newShadowPos - v3TargetPos; newShadowPos = Multiply(newShadowPos, matRot); newShadowPos = newShadowPos + v3TargetPos; v2ShadowPos.x = newShadowPos.x; v2ShadowPos.y = newShadowPos.y; // rotate the light source to cast it correctly Vector3 newPos = v3LightPos - v3TargetPos; newPos = Multiply(newPos, matRot); v3LightPos = newPos + v3TargetPos; } Vector3 diff = v3EntityPos - v3LightPos; const float squaredDist = DP3(diff, diff); float squaredRange = light.range * light.range; if (squaredDist > squaredRange) { return true; } v2ShadowSize.x *= _ETH_SHADOW_SCALEX * scale; // calculate the correct shadow length according to the light height if ((GetPosition().z+v2Size.y) < light.pos.z) // if the light is over the entity { const float planarDist = Distance(GetPositionXY(), ETHGlobal::ToVector2(v3LightPos)); const float verticalDist = Abs((v3EntityPos.z+v2Size.y)-v3LightPos.z); const float totalDist = (planarDist/verticalDist)*Abs(v3LightPos.z); v2ShadowSize.y = totalDist-planarDist; // clamp shadow length to the object's height. This is not realistic // but it looks better for the real-time shadows. v2ShadowSize.y = Min(v2Size.y*_ETH_SHADOW_FAKE_STRETCH, v2ShadowSize.y); } else { v2ShadowSize.y *= ((drawToTarget) ? _ETH_SHADOW_SCALEY : _ETH_SHADOW_SCALEY/4); } // specify a minimum length for the shadow v2ShadowSize.y = Max(v2ShadowSize.y, v2Size.y); ShaderPtr pVS = video->GetVertexShader(); pVS->SetConstant(GS_L("shadowLength"), v2ShadowSize.y * m_properties.shadowLengthScale); pVS->SetConstant(GS_L("entityZ"), Max(m_shadowZ, v3EntityPos.z)); pVS->SetConstant(GS_L("shadowZ"), m_shadowZ); pVS->SetConstant(GS_L("lightPos"), v3LightPos); video->SetSpriteDepth( (GetType() == ETHEntityProperties::ET_VERTICAL) ? ETHEntity::ComputeDepth(m_shadowZ, maxHeight, minHeight) : Max(0.0f, ComputeDepth(maxHeight, minHeight) - m_layrableMinimumDepth)); v2ShadowSize.y = 1.0f; Vector2 lightPos2(v3LightPos.x, v3LightPos.y); const float shadowAngle = ::GetAngle((lightPos2 - Vector2(v3EntityPos.x, v3EntityPos.y))) + DegreeToRadian(targetAngle); squaredRange = Max(squaredDist, squaredRange); float attenBias = 1; // adjust brightness according to ambient light if (!maxOpacity) { attenBias = (1-(squaredDist/squaredRange)); //fade the color according to the light brightness const float colorLen = Max(Max(light.color.x, light.color.y), light.color.z); attenBias *= Min(colorLen, 1.0f); //fade the color according to the ambient light brightness const Vector3 &ambientColor = sceneProps.ambient; const float ambientColorLen = 1.0f-((ambientColor.x + ambientColor.y + ambientColor.z)/3.0f); attenBias = Min(attenBias*ambientColorLen, 1.0f); attenBias *= Max(Min((1-(GetPosition().z/Max(GetCurrentSize().y, 1.0f))), 1.0f), 0.0f); } GS_BYTE alpha = static_cast<GS_BYTE>(attenBias*255.0f*opacity); if (alpha < 8) return true; Color dwShadowColor(alpha,255,255,255); pShadow->SetOrigin(Vector2(0.5f, 0.79f)); pShadow->SetRectMode(Sprite::RM_THREE_TRIANGLES); pShadow->DrawShaped(v2ShadowPos, v2ShadowSize, dwShadowColor, dwShadowColor, dwShadowColor, dwShadowColor, RadianToDegree(shadowAngle)); return true; }
Vec3<T>& rotateDegree(T degree) { rotate(DegreeToRadian(degree)); return *this; }
void DebugDrawer::DrawCone(const Vector3f& origin, const Quaternionf& rotation, float angle, float length) { if (!Initialize()) { NazaraError("Failed to initialize Debug Drawer"); return; } Matrix4f transformMatrix; transformMatrix.MakeIdentity(); transformMatrix.SetRotation(rotation); transformMatrix.SetTranslation(origin); BufferMapper<VertexBuffer> mapper(s_vertexBuffer, BufferAccess_DiscardAndWrite, 0, 16); VertexStruct_XYZ* vertex = reinterpret_cast<VertexStruct_XYZ*>(mapper.GetPointer()); // On calcule le reste des points Vector3f base(Vector3f::Forward()*length); // Il nous faut maintenant le rayon du cercle projeté à cette distance // Tangente = Opposé/Adjaçent <=> Opposé = Adjaçent*Tangente float radius = length*std::tan(DegreeToRadian(angle)); Vector3f lExtend = Vector3f::Left()*radius; Vector3f uExtend = Vector3f::Up()*radius; vertex->position.Set(transformMatrix * Vector3f::Zero()); vertex++; vertex->position.Set(transformMatrix * (base + lExtend + uExtend)); vertex++; vertex->position.Set(transformMatrix * (base + lExtend + uExtend)); vertex++; vertex->position.Set(transformMatrix * (base + lExtend - uExtend)); vertex++; vertex->position.Set(transformMatrix * Vector3f::Zero()); vertex++; vertex->position.Set(transformMatrix * (base + lExtend - uExtend)); vertex++; vertex->position.Set(transformMatrix * (base + lExtend - uExtend)); vertex++; vertex->position.Set(transformMatrix * (base - lExtend - uExtend)); vertex++; vertex->position.Set(transformMatrix * Vector3f::Zero()); vertex++; vertex->position.Set(transformMatrix * (base - lExtend + uExtend)); vertex++; vertex->position.Set(transformMatrix * (base - lExtend + uExtend)); vertex++; vertex->position.Set(transformMatrix * (base - lExtend - uExtend)); vertex++; vertex->position.Set(transformMatrix * Vector3f::Zero()); vertex++; vertex->position.Set(transformMatrix * (base - lExtend - uExtend)); vertex++; vertex->position.Set(transformMatrix * (base - lExtend + uExtend)); vertex++; vertex->position.Set(transformMatrix * (base + lExtend + uExtend)); vertex++; mapper.Unmap(); Renderer::SetRenderStates(s_renderStates); Renderer::SetShader(s_shader); Renderer::SetVertexBuffer(&s_vertexBuffer); s_shader->SendColor(s_colorLocation, s_primaryColor); Renderer::DrawPrimitives(PrimitiveMode_LineList, 0, 16); }
bool ETHParticleManager::CreateParticleSystem( const ETHParticleSystem& partSystem, const Vector2& v2Pos, const Vector3& v3Pos, const float angle, const float entityVolume, const float scale) { GS2D_UNUSED_ARGUMENT(v3Pos); if (partSystem.nParticles <= 0) { ETH_STREAM_DECL(ss) << GS_L("ETHParticleManager::CreateParticleSystem: The number of particles must be greater than 0."); m_provider->Log(ss.str(), Platform::FileLogger::ERROR); return false; } m_finished = false; m_killed = false; m_nActiveParticles = 0; m_soundVolume = 1.0f; m_isSoundLooping = false; m_isSoundStopped = false; m_generalVolume = 1.0f; m_system = partSystem; m_entityVolume = entityVolume; m_system.Scale(scale); if (m_system.bitmapFile.empty()) { m_system.bitmapFile = ETH_DEFAULT_PARTICLE_BITMAP; } ETHGraphicResourceManagerPtr graphics = m_provider->GetGraphicResourceManager(); ETHAudioResourceManagerPtr samples = m_provider->GetAudioResourceManager(); Platform::FileIOHubPtr fileIOHub = m_provider->GetFileIOHub(); Platform::FileManagerPtr fileManager = m_provider->GetFileManager(); // if there's no resource path, search the current module's path const str_type::string& resourcePath = fileIOHub->GetResourceDirectory(); const str_type::string& programPath = fileIOHub->GetProgramDirectory(); const str_type::string currentPath = (resourcePath.empty() && !fileManager->IsPacked()) ? programPath : resourcePath; m_pBMP = graphics->GetPointer(m_provider->GetVideo(), m_system.bitmapFile, currentPath, ETHDirectories::GetParticlesDirectory(), (m_system.alphaMode == Video::AM_ADD)); // find the particle sound effect if (m_system.soundFXFile != GS_L("")) { m_pSound = samples->GetPointer(m_provider->GetAudio(), m_provider->GetFileIOHub(), m_system.soundFXFile, ETHDirectories::GetSoundFXDirectory(), Audio::SOUND_EFFECT); } if (m_system.allAtOnce) { m_nActiveParticles = m_system.nParticles; } else { m_nActiveParticles = 0; } m_particles.resize(m_system.nParticles); Matrix4x4 rot = RotateZ(DegreeToRadian(angle)); for (int t = 0; t < m_system.nParticles; t++) { m_particles[t].id = t; m_particles[t].released = false; ResetParticle(t, v2Pos, Vector3(v2Pos,0), angle, rot); } return true; }
bool ETHParticleManager::UpdateParticleSystem( const Vector2& v2Pos, const Vector3& v3Pos, const float angle, const unsigned long lastFrameElapsedTime) { bool anythingDrawn = false; const unsigned long cappedLastFrameElapsedTime = Min(lastFrameElapsedTime, static_cast<unsigned long>(250)); const float frameSpeed = static_cast<float>((static_cast<double>(cappedLastFrameElapsedTime) / 1000.0) * 60.0); Matrix4x4 rot = RotateZ(DegreeToRadian(angle)); m_nActiveParticles = 0; for (int t = 0; t < m_system.nParticles; t++) { PARTICLE& particle = m_particles[t]; if (m_system.repeat > 0) if (particle.repeat >= m_system.repeat) continue; // check how many particles are active if (particle.size > 0.0f && particle.released) { if (!Killed() || (Killed() && particle.elapsed < particle.lifeTime)) m_nActiveParticles++; } anythingDrawn = true; particle.elapsed += lastFrameElapsedTime; if (!particle.released) { // if we shouldn't release all particles at the same time, check if it's time to release this particle const float releaseTime = ((m_system.lifeTime + m_system.randomizeLifeTime) * (static_cast<float>(particle.id) / static_cast<float>(m_system.nParticles))); if (particle.elapsed > releaseTime || m_system.allAtOnce) { particle.elapsed = 0.0f; particle.released = true; PositionParticle(t, v2Pos, angle, rot, v3Pos); } } if (particle.released) { particle.dir += (m_system.gravityVector * frameSpeed); particle.pos += (particle.dir * frameSpeed); particle.angle += (particle.angleDir * frameSpeed); particle.size += (m_system.growth * frameSpeed); const float w = particle.elapsed / particle.lifeTime; particle.color = m_system.color0 + (m_system.color1 - m_system.color0) * w; // update particle animation if there is any if (m_system.spriteCut.x > 1 || m_system.spriteCut.y > 1) { if (m_system.animationMode == ETHParticleSystem::PLAY_ANIMATION) { particle.currentFrame = static_cast<unsigned int>( Min(static_cast<int>(static_cast<float>(m_system.GetNumFrames()) * w), m_system.GetNumFrames() - 1)); } } particle.size = Min(particle.size, m_system.maxSize); particle.size = Max(particle.size, m_system.minSize); if (particle.elapsed > particle.lifeTime) { particle.repeat++; if (!Killed()) ResetParticle(t, v2Pos, v3Pos, angle, rot); } } } m_finished = !anythingDrawn; // manages the sound HandleSoundPlayback(v2Pos, frameSpeed); return true; }
// processes camera controls void ShadowCamera::DoControls(void) { float fDeltaTime = DeltaTimeUpdate(m_ControlState.fLastUpdate); noVec3 vZ = Normalize(m_vTarget - m_vSource); noVec3 vX = Normalize(Cross(m_vUpVector, vZ)); noVec3 vY = Normalize(Cross(vZ, vX)); // Rotating with mouse left // // if(GetMouseDown(VK_LBUTTON)) { if(!m_ControlState.bRotating) { GetCursorPos(&m_ControlState.pntMouse); m_ControlState.bZooming = false; m_ControlState.bStrafing = false; m_ControlState.bRotating = true; } POINT pntMouseCurrent; GetCursorPos(&pntMouseCurrent); noVec3 vTargetToSource = m_vTarget - m_vSource; float fLength = vTargetToSource.Length(); m_ControlState.fRotX += 0.005f * (float)(pntMouseCurrent.x - m_ControlState.pntMouse.x); m_ControlState.fRotY += 0.005f * (float)(pntMouseCurrent.y - m_ControlState.pntMouse.y); m_ControlState.fRotY = Clamp(m_ControlState.fRotY, DegreeToRadian(-89.9f), DegreeToRadian(89.9f)); Matrix mRotation; mRotation.SetIdentity(); mRotation.SetRotation(noVec3(m_ControlState.fRotX, m_ControlState.fRotY,0)); m_vTarget.x = mRotation._31 * fLength + m_vSource.x; m_vTarget.y = mRotation._32 * fLength + m_vSource.y; m_vTarget.z = mRotation._33 * fLength + m_vSource.z; m_ControlState.pntMouse = pntMouseCurrent; // Strafing with mouse middle // // } else if(GetMouseDown(VK_MBUTTON)) { if(!m_ControlState.bStrafing) { GetCursorPos(&m_ControlState.pntMouse); m_ControlState.bZooming = false; m_ControlState.bRotating = false; m_ControlState.bStrafing = true; } POINT pntMouseCurrent; GetCursorPos(&pntMouseCurrent); m_vSource -= vX * 0.15f * (float)(pntMouseCurrent.x - m_ControlState.pntMouse.x); m_vTarget -= vX * 0.15f * (float)(pntMouseCurrent.x - m_ControlState.pntMouse.x); m_vSource += vY * 0.15f * (float)(pntMouseCurrent.y - m_ControlState.pntMouse.y); m_vTarget += vY * 0.15f * (float)(pntMouseCurrent.y - m_ControlState.pntMouse.y); m_ControlState.pntMouse = pntMouseCurrent; // Zooming with mouse right // // } else if(GetMouseDown(VK_RBUTTON)) { if(!m_ControlState.bZooming) { GetCursorPos(&m_ControlState.pntMouse); m_ControlState.bZooming = true; m_ControlState.bRotating = false; m_ControlState.bStrafing = false; } POINT pntMouseCurrent; GetCursorPos(&pntMouseCurrent); m_vSource += vZ * 0.5f * (float)(pntMouseCurrent.y - m_ControlState.pntMouse.y); m_vTarget += vZ * 0.5f * (float)(pntMouseCurrent.y - m_ControlState.pntMouse.y); m_ControlState.pntMouse = pntMouseCurrent; // Mouse is idle // } else { m_ControlState.bZooming = false; m_ControlState.bRotating = false; m_ControlState.bStrafing = false; } // Move forward/backward // if(GetKeyDown('W')) { m_vSource += vZ * fDeltaTime; m_vTarget += vZ * fDeltaTime; } else if(GetKeyDown('S')) { m_vSource -= vZ * fDeltaTime; m_vTarget -= vZ * fDeltaTime; } // Strafing // if(GetKeyDown('D')) { m_vSource += vX * fDeltaTime; m_vTarget += vX * fDeltaTime; } else if(GetKeyDown('A')) { m_vSource -= vX * fDeltaTime; m_vTarget -= vX * fDeltaTime; } // Up/down (many control preferences here :) // if(GetKeyDown('Q') || GetKeyDown(VK_SPACE)) { m_vSource += vY * fDeltaTime; m_vTarget += vY * fDeltaTime; } else if(GetKeyDown('E') || GetKeyDown('C') || GetKeyDown(VK_CONTROL)) { m_vSource -= vY * fDeltaTime; m_vTarget -= vY * fDeltaTime; } CalculateMatrices(); }
bool ETHPixelLightDiffuseSpecular::BeginLightPass(ETHSpriteEntity *pRender, Vector3 &v3LightPos, const Vector2 &v2Size, const ETHLight* light, const float maxHeight, const float minHeight, const float lightIntensity, const bool drawToTarget) { const Vector2 &v2Origin = pRender->ComputeOrigin(v2Size); const Vector3 &v3EntityPos = pRender->GetPosition(); // set the correct light shader ShaderPtr pLightShader; const bool hasGloss = pRender->GetGloss(); if (pRender->GetType() == ETH_VERTICAL) { if (hasGloss) { pLightShader = m_vPixelLightSpecularPS; } else { pLightShader = m_vPixelLightPS; } } else { if (hasGloss) { pLightShader = m_hPixelLightSpecularPS; } else { pLightShader = m_hPixelLightPS; } } // if it has a gloss map, send specular data to shader if (hasGloss) { pLightShader->SetConstant(GS_L("specularPower"), pRender->GetSpecularPower()); pLightShader->SetConstant(GS_L("specularBrightness"), pRender->GetSpecularBrightness()); pLightShader->SetTexture(GS_L("glossMap"), pRender->GetGloss()->GetTexture()); pLightShader->SetConstant(GS_L("fakeEyePos"), m_fakeEyeManager->ComputeFakeEyePosition(m_video, pLightShader, drawToTarget, v3LightPos, pRender->GetAngle())); } // choose which normalmap to use m_video->SetPixelShader(pLightShader); if (pRender->GetNormal()) { pLightShader->SetTexture(GS_L("normalMap"), pRender->GetNormal()->GetTexture()); } else { pLightShader->SetTexture(GS_L("normalMap"), GetDefaultNormalMap()->GetTexture()); } // sets spatial information to the shader if (pRender->GetType() == ETH_VERTICAL) { m_vPixelLightVS->SetConstant(GS_L("spaceLength"), (maxHeight-minHeight)); m_vPixelLightVS->SetConstant(GS_L("topLeft3DPos"), v3EntityPos-(Vector3(v2Origin.x,0,-v2Origin.y))); m_video->SetVertexShader(m_vPixelLightVS); } else { m_hPixelLightVS->SetConstant(GS_L("topLeft3DPos"), v3EntityPos-Vector3(v2Origin,0)); m_video->SetVertexShader(m_hPixelLightVS); } const Vector2 v2ScreenDim = (drawToTarget) ? pRender->GetLightmap()->GetBitmapSizeF() : m_video->GetScreenSizeF(); if (pRender->GetType() != ETH_VERTICAL) { if (pRender->GetAngle() != 0.0f) { Vector3 newPos = v3LightPos-v3EntityPos; Matrix4x4 matRot = RotateZ(-DegreeToRadian(pRender->GetAngle())); newPos = Multiply(newPos, matRot); v3LightPos = newPos + v3EntityPos; } } m_lastAM = m_video->GetAlphaMode(); m_video->SetAlphaMode(GSAM_ADD); // Set a depth value depending on the entity type pRender->SetDepth(maxHeight, minHeight); pLightShader->SetConstant(GS_L("lightPos"), v3LightPos); pLightShader->SetConstant(GS_L("squaredRange"), light->range * light->range); pLightShader->SetConstant(GS_L("lightColor"), Vector4(light->color, 1.0f) * lightIntensity); return true; }
bool ETHPixelLightDiffuseSpecular::BeginLightPass(ETHSpriteEntity *pRender, Vector3 &v3LightPos, const Vector2 &v2Size, const ETHLight* light, const float maxHeight, const float minHeight, const float lightIntensity, const bool drawToTarget) { const Vector2 &v2Origin = pRender->ComputeAbsoluteOrigin(v2Size); const Vector3 &v3EntityPos = pRender->GetPosition(); // set the correct light shader ShaderPtr pLightShader; const bool hasGloss = pRender->GetGloss(); if (pRender->GetType() == ETHEntityProperties::ET_VERTICAL) { if (hasGloss) { pLightShader = m_vPixelLightSpecularPS; } else { pLightShader = m_vPixelLightPS; } } else { if (hasGloss) { pLightShader = m_hPixelLightSpecularPS; } else { pLightShader = m_hPixelLightPS; } } // if it has a gloss map, send specular data to shader if (hasGloss) { pLightShader->SetConstant(GS_L("specularPower"), pRender->GetSpecularPower()); pLightShader->SetConstant(GS_L("specularBrightness"), pRender->GetSpecularBrightness()); pLightShader->SetTexture(GS_L("glossMap"), pRender->GetGloss()->GetTexture()); pLightShader->SetConstant(GS_L("fakeEyePos"), m_fakeEyeManager->ComputeFakeEyePosition(m_video, pLightShader, drawToTarget, v3LightPos, pRender->GetAngle())); } // choose which normalmap to use m_video->SetPixelShader(pLightShader); if (pRender->GetNormal()) { pLightShader->SetTexture(GS_L("normalMap"), pRender->GetNormal()->GetTexture()); } else { pLightShader->SetTexture(GS_L("normalMap"), GetDefaultNormalMap()->GetTexture()); } // sets spatial information to the shader if (pRender->GetType() == ETHEntityProperties::ET_VERTICAL) { m_vPixelLightVS->SetConstant(GS_L("spaceLength"), (maxHeight-minHeight)); m_vPixelLightVS->SetConstant(GS_L("topLeft3DPos"), v3EntityPos-(Vector3(v2Origin.x,0,-v2Origin.y))); m_video->SetVertexShader(m_vPixelLightVS); } else { m_hPixelLightVS->SetConstant(GS_L("topLeft3DPos"), v3EntityPos-Vector3(v2Origin,0)); m_video->SetVertexShader(m_hPixelLightVS); } // TO-DO it looks like a mess around here... if (pRender->GetType() != ETHEntityProperties::ET_VERTICAL) { if (pRender->GetAngle() != 0.0f) { Vector3 newPos = v3LightPos-v3EntityPos; Matrix4x4 matRot = RotateZ(-DegreeToRadian(pRender->GetAngle())); newPos = Multiply(newPos, matRot); v3LightPos = newPos + v3EntityPos; } } m_lastAM = m_video->GetAlphaMode(); m_video->SetAlphaMode(Video::AM_ADD); // Set a depth value depending on the entity type pRender->SetDepth(maxHeight, minHeight); // downscales pixel shader ranges on android to prevent from lower precision glitches float lightPrecisionDownScale = 1.0f; #ifdef GLES2 lightPrecisionDownScale = LIGHT_PRECISION_DOWNSCALE; #endif pLightShader->SetConstant(GS_L("lightPos"), v3LightPos * lightPrecisionDownScale); const float scaledRange = (light->range * lightPrecisionDownScale); pLightShader->SetConstant(GS_L("squaredRange"), scaledRange * scaledRange); pLightShader->SetConstant(GS_L("lightColor"), Vector4(light->color, 1.0f) * lightIntensity); return true; }
int _tmain(int argc, _TCHAR* argv[]) { bool result = false; TArgInfo info; ParseArg(info,argc,argv); const std::string &m = info.m_mode; //printf("mode=%s\n", m.c_str()); if("f32_hex" == m){ result = Float32ToHex(info); }else if("f64_hex" == m){ result = Float64ToHex(info); }else if("hex_f32" == m){ result = HexToFloat32(info); }else if("hex_f64" == m){ result = HexToFloat64(info); }else if("2_10" == m){ result = ConvertNumber(info,10,2); }else if("2_16" == m){ result = ConvertNumber(info,16,2); }else if("10_2" == m){ result = ConvertNumber(info,2,10); }else if("10_16" == m){ result = ConvertNumber(info,16,10); }else if("16_2" == m){ result = ConvertNumber(info,2,16); }else if("16_10" == m){ result = ConvertNumber(info,10,16); }else if("r_d" == m){ result = RadianToDegree(info); }else if("d_r" == m){ result = DegreeToRadian(info); }else if("v_h" == m){ result = MatrixSub(info,FovVerticalToHorizontal,3); }else if("h_v" == m){ result = MatrixSub(info,FovHorizontalToVertical,3); }else if("ql" == m){ result = MatrixSub(info,QuatLength,4); }else if("qn" == m){ result = MatrixSub(info,QuatNormalize,4); }else if("qi" == m){ result = MatrixSub(info,QuatInverse,4); }else if("q_m33" == m){ result = MatrixSub(info,QuatToMat,4); }else if("q_a" == m){ result = MatrixSub(info,QuatToAAng,4); }else if("q_xyz" == m){ result = MatrixSub(info,QuatToXYZ,4); }else if("m33_q" == m){ result = MatrixSub(info,Mat33ToQuat,9); }else if("m33_a" == m){ result = MatrixSub(info,Mat33ToAAng,9); }else if("m33t" == m){ result = MatrixSub(info,Mat33Transpose,9); }else if("m33d" == m){ result = MatrixSub(info,Mat33Determinant,9); }else if("m33i" == m){ result = MatrixSub(info,Mat33Invert,9); }else if("m33_s" == m){ result = MatrixSub(info,Mat33Scale,9); }else if("x_m33" == m){ result = MatrixSub(info,Mat33RotX,1); }else if("y_m33" == m){ result = MatrixSub(info,Mat33RotY,1); }else if("z_m33" == m){ result = MatrixSub(info,Mat33RotZ,1); }else if("yxz_m33" == m){ result = MatrixSub(info,Mat33RotYXZ,3); }else if("zxy_m33" == m){ result = MatrixSub(info,Mat33RotZXY,3); }else if("zyx_m33" == m){ result = MatrixSub(info,Mat33RotZYX,3); }else if("yzx_m33" == m){ result = MatrixSub(info,Mat33RotYZX,3); }else if("xzy_m33" == m){ result = MatrixSub(info,Mat33RotXZY,3); }else if("xyz_m33" == m){ result = MatrixSub(info,Mat33RotXYZ,3); }else if("m33_yxz" == m){ result = MatrixSub(info,Mat33EulerYXZ,9); }else if("m33_zxy" == m){ result = MatrixSub(info,Mat33EulerZXY,9); }else if("m33_zyx" == m){ result = MatrixSub(info,Mat33EulerZYX,9); }else if("m33_yzx" == m){ result = MatrixSub(info,Mat33EulerYZX,9); }else if("m33_xzy" == m){ result = MatrixSub(info,Mat33EulerXZY,9); }else if("m33_xyz" == m){ result = MatrixSub(info,Mat33EulerXYZ,9); }else if("v3l" == m){ result = MatrixSub(info,Vector3Length,3); }else if("v3n" == m){ result = MatrixSub(info,Vector3Normalize,3); } if(result){ return 0; } usage(); return 1; }