@@ -107,7 +107,15 @@ namespace openlima {
return this->mouse;
}

void Window::showWindow() {
void Window::close() {
this->systemWindow->closeWindow();
}

void Window::hide() {
this->systemWindow->hideWindow();
}

void Window::show() {
this->systemWindow->showWindow();
}

@@ -131,9 +131,19 @@ namespace openlima {
OPENLIMA_DLL openlima::input::Mouse* getKeyboard();

/**
* Shows the window.
* Closes this window.
*/
OPENLIMA_DLL void showWindow();
OPENLIMA_DLL void close();

/**
* Hides this window.
*/
OPENLIMA_DLL void hide();

/**
* Shows this window.
*/
OPENLIMA_DLL void show();

/**
* Sets the title of this window.
@@ -317,6 +317,15 @@ namespace openlima {
}
}

void SystemWindow::closeWindow() {
DestroyWindow(hWnd);
}

void SystemWindow::hideWindow() {
ShowWindow(hWnd, SW_HIDE);
UpdateWindow(hWnd);
}

void SystemWindow::showWindow() {
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
@@ -119,7 +119,30 @@ namespace openlima {
* Finalizer.
*/
OPENLIMA_DLL virtual ~SystemWindow();


/**
* Executes a step of the main loop.
*
* @return True if the main loop is still active, false if any window was closed.
*/
OPENLIMA_DLL static bool mainLoopStep();

/**
* Starts the main loop. It basically loops through "mainLoopStep"s as long as that
* method returns true.
*/
OPENLIMA_DLL static void mainLoop();

/**
* Closes this window.
*/
OPENLIMA_DLL void closeWindow();

/**
* Hides this window.
*/
OPENLIMA_DLL void hideWindow();

/**
* Shows the window.
@@ -184,19 +207,6 @@ namespace openlima {
*/
OPENLIMA_DLL int getHeight();

/**
* Executes a step of the main loop.
*
* @return True if the main loop is still active, false if any window was closed.
*/
OPENLIMA_DLL static bool mainLoopStep();

/**
* Starts the main loop. It basically loops through "mainLoopStep"s as long as that
* method returns true.
*/
OPENLIMA_DLL static void mainLoop();

};

}
@@ -49,6 +49,112 @@ namespace openlima {
*/
Vector3() : x(), y(), z() {}


/**
* Calculates the surface normal. Use computeNormalized() to normalize the surface normal.
*
* @param p1 The first vector of the surface.
* @param p2 The second vector of the surface.
* @param p3 The third vector of the surface.
*
* @return The calculated surface normal.
*/
static Vector3<T> computeSurfaceNormal(const Vector3<T>& p1, const Vector3<T>& p2,
const Vector3<T>& p3) {
Vector3<T> v1 = (p2 - p1);
Vector3<T> v2 = (p3 - p1);
Vector3<T> n;
n.x = (v1.y * v2.z) - (v1.z * v2.y);
n.y = -((v2.z * v1.x) - (v2.x * v1.z));
n.z = (v1.x * v2.y) - (v1.y * v2.x);

return n;
}


/**
* Gets the normalized version of this vector.
*
* @return The normalized version of this vector.
*/
Vector3<T> computeNormalized() const {
T nFactor = sqrt(
(this->x * this->x) +
(this->y * this->y) +
(this->z * this->z));

return Vector3<T>(
this->x / nFactor,
this->y / nFactor,
this->z / nFactor);
}

/**
* Compares this vector with the given other vector.
*
* @param other The other vector.
*
* @return True if this vector has the same coordinates as the other, else false.
*/
bool Vector3::operator ==(const Vector3& other) const {
return this->x == other.x && this->y == other.y && this->z == other.z;
}

/**
* Compares this vector with the given other vector.
*
* @param other The other vector.
*
* @return True if this vector has different coordinates as the other, else false.
*/
bool Vector3::operator !=(const Vector3& other) const {
return this->x != other.x || this->y != other.y || this->z != other.z;
}

/**
* Returns the sum of this vector and the given other vector.
*
* @param other The other vector.
*
* @return The sum of this vector and the other vector.
*/
Vector3 Vector3::operator +(const Vector3& other) const {
return Vector3(this->x + other.x, this->y + other.y, this->z + other.z);
}

/**
* Returns the difference between this vector and the given other vector.
*
* @param other The other vector.
*
* @return The difference between this vector and the other vector.
*/
Vector3 Vector3::operator -(const Vector3& other) const {
return Vector3(this->x - other.x, this->y - other.y, this->z - other.z);
}

/**
* Returns the product of this vector and the given other vector.
*
* @param other The other vector.
*
* @return The product of this vector and the other vector.
*/
Vector3 Vector3::operator *(const Vector3& other) const {
return Vector3(this->x * other.x, this->y * other.y, this->z * other.z);
}

/**
* Returns the quotient of this vector and the given other vector.
*
* @param other The other vector.
*
* @return The quotient of this vector and the other vector.
*/
Vector3 Vector3::operator /(const Vector3& other) const {
return Vector3(this->x / other.x, this->y / other.y, this->z / other.y);
}

};

/**