Merge branch 'GameLogicBranch' of https://github.com/dean11/Danbias into GameLogicBranch
Conflicts: Bin/DLL/GamePhysics_x86D.dll Bin/DLL/GamePhysics_x86D.exp Bin/DLL/GamePhysics_x86D.ilk Bin/DLL/GamePhysics_x86D.pdb Code/GameLogic/Object.cpp Code/GameLogic/Object.h
This commit is contained in:
commit
899e833fca
|
@ -29,6 +29,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GamePhysics", "GamePhysics\
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tester", "Tester\Tester.vcxproj", "{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DanBiasGame", "DanBiasGame\DanBiasGame.vcxproj", "{2A1BC987-AF42-4500-802D-89CD32FC1309}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
|
@ -175,6 +177,7 @@ Global
|
|||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Debug|x64.Build.0 = Debug|x64
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{104FA3E9-94D9-4E1D-A941-28A03BC8A095}.Release|Win32.ActiveCfg = Release|Win32
|
||||
|
@ -190,6 +193,18 @@ Global
|
|||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|Win32.Build.0 = Release|Win32
|
||||
{1B3BEA4C-CF75-438A-9693-60FB8444BBF3}.Release|x64.ActiveCfg = Release|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Debug|x64.Build.0 = Debug|x64
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|Win32.Build.0 = Release|Win32
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|x64.ActiveCfg = Release|x64
|
||||
{2A1BC987-AF42-4500-802D-89CD32FC1309}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -0,0 +1,321 @@
|
|||
//--------------------------------------------------------------------------------------
|
||||
// File: TemplateMain.cpp
|
||||
//
|
||||
// BTH-D3D-Template
|
||||
//
|
||||
// Copyright (c) Stefan Petersson 2011. All rights reserved.
|
||||
//--------------------------------------------------------------------------------------
|
||||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
|
||||
#include "DllInterfaces/GFXAPI.h"
|
||||
#include "IGame.h"
|
||||
|
||||
#include "L_inputClass.h"
|
||||
|
||||
// debug window include
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Global Variables
|
||||
//--------------------------------------------------------------------------------------
|
||||
HINSTANCE g_hInst = NULL;
|
||||
HWND g_hWnd = NULL;
|
||||
|
||||
GameLogic::IGame* game;
|
||||
InputClass* inputObj;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
//--------------------------------------------------------------------------------------
|
||||
HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow );
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
HRESULT Render(float deltaTime);
|
||||
HRESULT Update(float deltaTime);
|
||||
HRESULT InitGame();
|
||||
HRESULT CleanUp();
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Entry point to the program. Initializes everything and goes into a message processing
|
||||
// loop. Idle time is used to render the scene.
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
void SetStdOutToNewConsole()
|
||||
{
|
||||
// allocate a console for this app
|
||||
AllocConsole();
|
||||
|
||||
// redirect unbuffered STDOUT to the console
|
||||
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
int fileDescriptor = _open_osfhandle((intptr_t)consoleHandle, _O_TEXT);
|
||||
FILE *fp = _fdopen( fileDescriptor, "w" );
|
||||
*stdout = *fp;
|
||||
setvbuf( stdout, NULL, _IONBF, 0 );
|
||||
|
||||
// give the console window a nicer title
|
||||
|
||||
SetConsoleTitle(L"Debug Output");
|
||||
|
||||
// give the console window a bigger buffer size
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
if ( GetConsoleScreenBufferInfo(consoleHandle, &csbi) )
|
||||
{
|
||||
COORD bufferSize;
|
||||
bufferSize.X = csbi.dwSize.X;
|
||||
bufferSize.Y = 50;
|
||||
SetConsoleScreenBufferSize(consoleHandle, bufferSize);
|
||||
}
|
||||
}
|
||||
|
||||
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
|
||||
{
|
||||
SetDllDirectory(L"..\\DLL\\");
|
||||
typedef struct tagLOADPARMS32 {
|
||||
LPSTR lpEnvAddress; // address of environment strings
|
||||
LPSTR lpCmdLine; // address of command line
|
||||
LPSTR lpCmdShow; // how to show new program
|
||||
DWORD dwReserved; // must be zero
|
||||
} LOADPARMS32;
|
||||
LOADPARMS32 p;
|
||||
p.lpEnvAddress = "";
|
||||
p.lpCmdLine = "";
|
||||
p.lpCmdShow = "";
|
||||
p.dwReserved = 0;
|
||||
DWORD ret = 1;
|
||||
ret = LoadModule("OysterGraphics_x86D.dll", &p);
|
||||
|
||||
if( ret == 0)
|
||||
{
|
||||
// error
|
||||
return 0;
|
||||
}
|
||||
ret = LoadModule("GameLogic_x86D.dll", &p);
|
||||
if( ret == 0)
|
||||
{
|
||||
// error
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
|
||||
return 0;
|
||||
|
||||
if( FAILED( InitGame() ) )
|
||||
return 0;
|
||||
|
||||
__int64 cntsPerSec = 0;
|
||||
QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec);
|
||||
float secsPerCnt = 1.0f / (float)cntsPerSec;
|
||||
|
||||
__int64 prevTimeStamp = 0;
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
|
||||
|
||||
//debug window
|
||||
//SetStdOutToNewConsole();
|
||||
// Main message loop
|
||||
MSG msg = {0};
|
||||
while(WM_QUIT != msg.message)
|
||||
{
|
||||
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE) )
|
||||
{
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessage( &msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
__int64 currTimeStamp = 0;
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&currTimeStamp);
|
||||
float dt = (currTimeStamp - prevTimeStamp) * secsPerCnt;
|
||||
|
||||
//render
|
||||
Update(dt);
|
||||
Render(dt);
|
||||
|
||||
prevTimeStamp = currTimeStamp;
|
||||
}
|
||||
}
|
||||
CleanUp();
|
||||
return (int) msg.wParam;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Register class and create window
|
||||
//--------------------------------------------------------------------------------------
|
||||
HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow )
|
||||
{
|
||||
// Register class
|
||||
WNDCLASSEX wcex;
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = 0;
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = NULL;
|
||||
wcex.lpszClassName = L"BTH_D3D_Template";
|
||||
wcex.hIconSm = 0;
|
||||
if( !RegisterClassEx(&wcex) )
|
||||
return E_FAIL;
|
||||
|
||||
// Adjust and create window
|
||||
g_hInst = hInstance;
|
||||
RECT rc = { 0, 0, 1024, 768 };
|
||||
AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE );
|
||||
|
||||
if(!(g_hWnd = CreateWindow(
|
||||
L"BTH_D3D_Template",
|
||||
L"BTH - Direct3D 11.0 Template",
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
rc.right - rc.left,
|
||||
rc.bottom - rc.top,
|
||||
NULL,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
ShowWindow( g_hWnd, nCmdShow );
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT InitGame()
|
||||
{
|
||||
inputObj = new InputClass;
|
||||
if(!inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
|
||||
{
|
||||
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
if(Oyster::Graphics::API::Init(g_hWnd, false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess)
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
game = new GameLogic::IGame();
|
||||
game->Init();
|
||||
game->StartGame();
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT Update(float deltaTime)
|
||||
{
|
||||
inputObj->Update();
|
||||
GameLogic::keyInput key = GameLogic::keyInput_none;
|
||||
|
||||
if(inputObj->IsKeyPressed(DIK_W))
|
||||
{
|
||||
key = GameLogic::keyInput_W;
|
||||
}
|
||||
else if(inputObj->IsKeyPressed(DIK_A))
|
||||
{
|
||||
key = GameLogic::keyInput_A;
|
||||
}
|
||||
else if(inputObj->IsKeyPressed(DIK_S))
|
||||
{
|
||||
key = GameLogic::keyInput_S;
|
||||
}
|
||||
else if(inputObj->IsKeyPressed(DIK_D))
|
||||
{
|
||||
key = GameLogic::keyInput_D;
|
||||
}
|
||||
|
||||
game->Update(key);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Render(float deltaTime)
|
||||
{
|
||||
int isPressed = 0;
|
||||
if(inputObj->IsKeyPressed(DIK_A))
|
||||
{
|
||||
isPressed = 1;
|
||||
//std::cout<<"test";
|
||||
}
|
||||
|
||||
// test view and projection matrix
|
||||
Oyster::Math::Float3 dir = Oyster::Math::Float3(0,0,-1);
|
||||
Oyster::Math::Float3 up =Oyster::Math::Float3(0,1,0);
|
||||
Oyster::Math::Float3 pos = Oyster::Math::Float3(0, 0, 100);
|
||||
|
||||
Oyster::Math::Float4x4 view =Oyster::Math3D::OrientationMatrix_LookAtDirection(dir, up, pos);
|
||||
view = view.GetInverse();
|
||||
|
||||
Oyster::Math::Float4x4 proj = Oyster::Math3D::ProjectionMatrix_Perspective(3.14f/2, 1024/768, 1, 1000);
|
||||
|
||||
Oyster::Graphics::API::NewFrame(view, proj);
|
||||
|
||||
game->Render();
|
||||
wchar_t title[255];
|
||||
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
|
||||
SetWindowText(g_hWnd, title);
|
||||
|
||||
Oyster::Graphics::API::EndFrame();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CleanUp()
|
||||
{
|
||||
|
||||
if(game)
|
||||
{
|
||||
delete game;
|
||||
game = NULL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Called every time the application receives a message
|
||||
//--------------------------------------------------------------------------------------
|
||||
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
EndPaint(hWnd, &ps);
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
|
||||
switch(wParam)
|
||||
{
|
||||
case VK_ESCAPE:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
|
@ -28,6 +28,8 @@ void CollisionManager::ColisionEvent(Oyster::Physics::ICustomBody &obj1, Oyster:
|
|||
PlayerVBox(*((Player*)realObj1),*((DynamicObject*)realObj2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
case Object::OBJECT_TYPE_BOX:
|
||||
|
||||
|
|
|
@ -9,7 +9,12 @@ Game::Game(void)
|
|||
|
||||
Game::~Game(void)
|
||||
{
|
||||
SAFE_DELETE(player);
|
||||
//SAFE_DELETE(player);
|
||||
if(player)
|
||||
{
|
||||
delete player;
|
||||
player = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void Game::Init()
|
||||
|
@ -20,11 +25,13 @@ void Game::StartGame()
|
|||
{
|
||||
|
||||
}
|
||||
void Game::Update()
|
||||
void Game::Update(keyInput keyPressed)
|
||||
{
|
||||
player->Update();
|
||||
player->Update(keyPressed);
|
||||
}
|
||||
void Game::Render()
|
||||
{
|
||||
player->Render();
|
||||
Oyster::Graphics::Model::Model* model_Arr;
|
||||
model_Arr = player->Render();
|
||||
Oyster::Graphics::API::RenderScene(model_Arr, 1);
|
||||
}
|
|
@ -3,9 +3,12 @@
|
|||
|
||||
#include "Level.h"
|
||||
#include "Player.h"
|
||||
#include "IGame.h"
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
|
||||
class Game
|
||||
{
|
||||
public:
|
||||
|
@ -14,7 +17,7 @@ namespace GameLogic
|
|||
|
||||
void Init();
|
||||
void StartGame();
|
||||
void Update();
|
||||
void Update(keyInput keyPressed);
|
||||
void Render();
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
|
@ -33,21 +33,21 @@
|
|||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
@ -69,37 +69,38 @@
|
|||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||
<TargetExt>.dll</TargetExt>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<LibraryPath>$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>$(SolutionDir)..\External\Lib\Input;$(SolutionDir)..\Bin\DLL;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
@ -107,12 +108,12 @@
|
|||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;Input_$(PlatformShortName)D.lib;GamePhysics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
@ -122,14 +123,14 @@
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -139,14 +140,14 @@
|
|||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)Input;$(SolutionDir)OysterGraphics;$(SolutionDir)Misc;$(SolutionDir)OysterMath;$(SolutionDir)OysterPhysics3D;$(SolutionDir)GamePhysics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>GAME_DLL_EXPORT;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;Input_$(PlatformShortName).lib;GamePhysics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
@ -158,6 +159,9 @@
|
|||
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Input\Input.vcxproj">
|
||||
<Project>{7e3990d2-3d94-465c-b58d-64a74b3ecf9b}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Misc\Misc.vcxproj">
|
||||
<Project>{2ec4dded-8f75-4c86-a10b-e1e8eb29f3ee}</Project>
|
||||
</ProjectReference>
|
||||
|
@ -191,7 +195,6 @@
|
|||
<ClCompile Include="Player.cpp" />
|
||||
<ClCompile Include="RefManager.cpp" />
|
||||
<ClCompile Include="StaticObject.cpp" />
|
||||
<ClCompile Include="TestGLMain.cpp" />
|
||||
<ClCompile Include="Weapon.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
|
|
@ -68,9 +68,6 @@
|
|||
<ClCompile Include="DynamicObject.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TestGLMain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RefManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -8,6 +8,7 @@ BOOL WINAPI DllMain(
|
|||
_In_ LPVOID lpvReserved
|
||||
)
|
||||
{
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
using namespace GameLogic;
|
||||
|
@ -30,9 +31,9 @@ void IGame::StartGame()
|
|||
{
|
||||
gameModule->StartGame();
|
||||
}
|
||||
void IGame::Update()
|
||||
void IGame::Update(keyInput keyPressed)
|
||||
{
|
||||
gameModule->Update();
|
||||
gameModule->Update(keyPressed);
|
||||
}
|
||||
void IGame::Render()
|
||||
{
|
||||
|
|
|
@ -15,6 +15,15 @@ namespace GameLogic
|
|||
{
|
||||
class Game;
|
||||
|
||||
enum keyInput
|
||||
{
|
||||
keyInput_W,
|
||||
keyInput_A,
|
||||
keyInput_S,
|
||||
keyInput_D,
|
||||
keyInput_none
|
||||
};
|
||||
|
||||
class GAME_DLL_USAGE IGame
|
||||
{
|
||||
private:
|
||||
|
@ -23,9 +32,13 @@ namespace GameLogic
|
|||
IGame();
|
||||
~IGame();
|
||||
|
||||
|
||||
void Init();
|
||||
void StartGame();
|
||||
void Update();
|
||||
/************************************************************************/
|
||||
/* Get key input to update the player */
|
||||
/************************************************************************/
|
||||
void Update(keyInput keyPressed);
|
||||
void Render();
|
||||
Game* getGameModule();
|
||||
private:
|
||||
|
|
|
@ -6,32 +6,84 @@
|
|||
using namespace GameLogic;
|
||||
|
||||
using namespace Oyster::Math;
|
||||
using namespace Oyster::Graphics::Render;
|
||||
using namespace Oyster::Graphics::Model;
|
||||
|
||||
using namespace Utility::DynamicMemory;
|
||||
|
||||
Object::Object(void)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
model = new Oyster::Graphics::Model::Model();
|
||||
model = Oyster::Graphics::API::CreateModel(L"bth.obj");
|
||||
|
||||
model->WorldMatrix *= 0.1f;
|
||||
model->WorldMatrix.m44 = 1.0f;
|
||||
=======
|
||||
model = new Model();
|
||||
model = Oyster::Graphics::API::CreateModel(L"bth.obj");
|
||||
|
||||
/*struct float4
|
||||
{
|
||||
float x,y,z,w;
|
||||
};
|
||||
|
||||
float4 mesh[] =
|
||||
{
|
||||
{-1.0f,1.0f,0.0f,1.0f},
|
||||
{1.0f,1.0f,0.0f,1.0f},
|
||||
{1.0f,-1.0f,0.0f,1.0f},
|
||||
};
|
||||
|
||||
Oyster::Graphics::Buffer::BUFFER_INIT_DESC desc;
|
||||
desc.ElementSize= sizeof(float4);
|
||||
desc.NumElements = 3;
|
||||
desc.InitData=mesh;
|
||||
desc.Type = Oyster::Graphics::Buffer::BUFFER_TYPE::VERTEX_BUFFER;
|
||||
desc.Usage = Oyster::Graphics::Buffer::BUFFER_USAGE::BUFFER_USAGE_IMMUTABLE;
|
||||
|
||||
Oyster::Graphics::Buffer *b = new Oyster::Graphics::Buffer();
|
||||
b->Init(desc);
|
||||
|
||||
ModelInfo* modelInfo = new ModelInfo();
|
||||
modelInfo->Vertices = *b;
|
||||
|
||||
modelInfo->Indexed = false;
|
||||
modelInfo->VertexCount = 3;
|
||||
|
||||
|
||||
Float4x4 matrix = Float4x4::identity;
|
||||
|
||||
model->World = &matrix;
|
||||
model->info = modelInfo;
|
||||
model->Visible = true;*/
|
||||
>>>>>>> 01515a4d2d309cfebf4e3dab3ad68787f93050e1
|
||||
}
|
||||
|
||||
|
||||
Object::~Object(void)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
//SAFE_DELETE(model->info);
|
||||
|
||||
Oyster::Graphics::API::DeleteModel(model);
|
||||
>>>>>>> 01515a4d2d309cfebf4e3dab3ad68787f93050e1
|
||||
}
|
||||
void Object::Render()
|
||||
Model* Object::Render()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
Oyster::Graphics::API::RenderScene(model,1);
|
||||
}
|
||||
|
||||
void Object::Update()
|
||||
{
|
||||
//dummy implementation that will be overloaded if the other class implements it in a different way
|
||||
=======
|
||||
//model->info->Vertices.Apply(0);
|
||||
this->rigidBody->GetOrientation(model->WorldMatrix);
|
||||
return model;
|
||||
>>>>>>> 01515a4d2d309cfebf4e3dab3ad68787f93050e1
|
||||
}
|
||||
|
||||
Object::OBJECT_TYPE Object::GetType()
|
||||
|
|
|
@ -6,20 +6,17 @@
|
|||
#ifndef OBJECT_H
|
||||
#define OBJECT_H
|
||||
|
||||
#include "Model/Model.h"
|
||||
#include "Render/Rendering/Render.h"
|
||||
#include "Utilities.h"
|
||||
#include "PhysicsAPI.h"
|
||||
#include "DllInterfaces/GFXAPI.h"
|
||||
|
||||
#include "Model/Model.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
|
||||
class Object
|
||||
{
|
||||
|
||||
|
||||
|
||||
public:
|
||||
Object(void);
|
||||
virtual ~Object(void);
|
||||
|
@ -30,8 +27,12 @@ namespace GameLogic
|
|||
OBJECT_TYPE_BOX,
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
void Render();
|
||||
void Update();
|
||||
=======
|
||||
Oyster::Graphics::Model::Model* Render();
|
||||
>>>>>>> 01515a4d2d309cfebf4e3dab3ad68787f93050e1
|
||||
|
||||
OBJECT_TYPE GetType();
|
||||
|
||||
|
@ -42,8 +43,13 @@ namespace GameLogic
|
|||
//either a model pointer or an ID to an arraypos filled with models that are to be rendered
|
||||
//rigidBody
|
||||
|
||||
<<<<<<< HEAD
|
||||
Utility::DynamicMemory::UniquePointer<Oyster::Physics::ICustomBody> rigidBody;
|
||||
Utility::DynamicMemory::UniquePointer<Oyster::Graphics::Model::Model> model;
|
||||
=======
|
||||
Oyster::Physics::ICustomBody* rigidBody;
|
||||
Oyster::Graphics::Model::Model* model;
|
||||
>>>>>>> 01515a4d2d309cfebf4e3dab3ad68787f93050e1
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -14,23 +14,51 @@ Player::Player(void)
|
|||
{
|
||||
life = 100;
|
||||
|
||||
rigidBody = API::Instance().CreateSimpleRigidBody();
|
||||
API::Instance().AddObject(rigidBody);
|
||||
Oyster::Physics::ICustomBody* temp = rigidBody = API::Instance().CreateSimpleRigidBody().Release();
|
||||
|
||||
rigidBody->SetCenter(Oyster::Math::Float3(50,0,0));
|
||||
rigidBody->SetMass_KeepMomentum(30);
|
||||
rigidBody->SetSize(Oyster::Math::Float3(2,2,2));
|
||||
rigidBody->SetSubscription(true);
|
||||
rigidBody->SetMomentOfInertiaTensor_KeepMomentum(Oyster::Math::Float4x4( Oyster::Physics::MomentOfInertia::CreateCuboidMatrix(30, 2, 2, 2)));
|
||||
|
||||
//API::Instance().AddObject(temp);
|
||||
}
|
||||
|
||||
|
||||
Player::~Player(void)
|
||||
{
|
||||
|
||||
delete this->rigidBody;
|
||||
}
|
||||
void Player::Update()
|
||||
void Player::Update(keyInput keyPressed)
|
||||
{
|
||||
if(keyPressed != keyInput_none)
|
||||
{
|
||||
Move();
|
||||
|
||||
if(keyPressed == keyInput_A)
|
||||
{
|
||||
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
||||
pos.x -= 0.1;
|
||||
rigidBody->SetCenter(pos);
|
||||
}
|
||||
if(keyPressed == keyInput_D)
|
||||
{
|
||||
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
||||
pos.x += 0.1;
|
||||
rigidBody->SetCenter(pos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Player::Move()
|
||||
{
|
||||
|
||||
//API::Instance().Update();
|
||||
/*Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
||||
pos.x += 0.1;
|
||||
rigidBody->SetCenter(pos);*/
|
||||
//API::Instance().SetCenter(rigidBody, pos);
|
||||
}
|
||||
void Player::Shoot()
|
||||
{
|
||||
|
|
|
@ -8,11 +8,13 @@
|
|||
|
||||
#include "Object.h"
|
||||
#include "Weapon.h"
|
||||
#include "IGame.h"
|
||||
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
|
||||
|
||||
class Player : public Object
|
||||
{
|
||||
|
||||
|
@ -20,7 +22,7 @@ namespace GameLogic
|
|||
Player(void);
|
||||
~Player(void);
|
||||
|
||||
void Update();
|
||||
void Update(keyInput keyPressed);
|
||||
|
||||
void Move();
|
||||
void Shoot();
|
||||
|
|
|
@ -8,13 +8,17 @@
|
|||
#define NOMINMAX
|
||||
#include <Windows.h>
|
||||
#include "Core/Core.h"
|
||||
#include "Render\Preparations\Preparations.h"
|
||||
#include "DllInterfaces/GFXAPI.h"
|
||||
#include "IGame.h"
|
||||
|
||||
#include "L_inputClass.h"
|
||||
|
||||
// debug window include
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
//#include "InputController.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -25,6 +29,7 @@ HINSTANCE g_hInst = NULL;
|
|||
HWND g_hWnd = NULL;
|
||||
|
||||
GameLogic::IGame* game;
|
||||
InputClass* inputObj;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
@ -89,7 +94,9 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
|
|||
|
||||
__int64 prevTimeStamp = 0;
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
|
||||
SetStdOutToNewConsole();
|
||||
|
||||
//debugwindow
|
||||
//SetStdOutToNewConsole();
|
||||
// Main message loop
|
||||
MSG msg = {0};
|
||||
while(WM_QUIT != msg.message)
|
||||
|
@ -171,7 +178,7 @@ HRESULT InitWindow( HINSTANCE hInstance, int nCmdShow )
|
|||
//--------------------------------------------------------------------------------------
|
||||
HRESULT InitDirect3D()
|
||||
{
|
||||
HRESULT hr = S_OK;;
|
||||
/*HRESULT hr = S_OK;;
|
||||
|
||||
Oyster::Graphics::Core::resolution = Oyster::Math::Float2( 1024, 768 );
|
||||
|
||||
|
@ -203,38 +210,85 @@ HRESULT InitDirect3D()
|
|||
|
||||
Oyster::Graphics::Render::Preparations::Basic::BindBackBufferRTV();
|
||||
|
||||
Oyster::Graphics::Render::Preparations::Basic::SetViewPort();
|
||||
Oyster::Graphics::Render::Preparations::Basic::SetViewPort();*/
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT InitGame()
|
||||
{
|
||||
|
||||
if(Oyster::Graphics::API::Init(g_hWnd, false, false, Oyster::Math::Float2( 1024, 768)) != Oyster::Graphics::API::Sucsess)
|
||||
return E_FAIL;
|
||||
|
||||
inputObj = new InputClass;
|
||||
if(!inputObj->Initialize(g_hInst, g_hWnd, 1024, 768))
|
||||
{
|
||||
MessageBox(0, L"Could not initialize the input object.", L"Error", MB_OK);
|
||||
return false;
|
||||
}
|
||||
game = new GameLogic::IGame();
|
||||
game->Init();
|
||||
game->StartGame();
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT Update(float deltaTime)
|
||||
{
|
||||
game->Update();
|
||||
inputObj->Update();
|
||||
GameLogic::keyInput key = GameLogic::keyInput_none;
|
||||
|
||||
if(inputObj->IsKeyPressed(DIK_W))
|
||||
{
|
||||
key = GameLogic::keyInput_W;
|
||||
}
|
||||
else if(inputObj->IsKeyPressed(DIK_A))
|
||||
{
|
||||
key = GameLogic::keyInput_A;
|
||||
}
|
||||
else if(inputObj->IsKeyPressed(DIK_S))
|
||||
{
|
||||
key = GameLogic::keyInput_S;
|
||||
}
|
||||
else if(inputObj->IsKeyPressed(DIK_D))
|
||||
{
|
||||
key = GameLogic::keyInput_D;
|
||||
}
|
||||
|
||||
game->Update(key);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT Render(float deltaTime)
|
||||
{
|
||||
//Oyster::Graphics::Render::Rendering::Basic::NewFrame();
|
||||
Oyster::Graphics::Render::Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,1,1));
|
||||
int isPressed = 0;
|
||||
if(inputObj->IsKeyPressed(DIK_A))
|
||||
{
|
||||
isPressed = 1;
|
||||
//std::cout<<"test";
|
||||
}
|
||||
|
||||
// test view and projection matrix
|
||||
Oyster::Math::Float3 dir = Oyster::Math::Float3(0,0,-1);
|
||||
Oyster::Math::Float3 up =Oyster::Math::Float3(0,1,0);
|
||||
Oyster::Math::Float3 pos = Oyster::Math::Float3(0, 0, 100);
|
||||
|
||||
Oyster::Math::Float4x4 view =Oyster::Math3D::OrientationMatrix_LookAtDirection(dir, up, pos);
|
||||
view = view.GetInverse();
|
||||
|
||||
Oyster::Math::Float4x4 proj = Oyster::Math3D::ProjectionMatrix_Perspective(PI/2, 1024/768, 1, 1000);
|
||||
|
||||
Oyster::Graphics::API::NewFrame(view, proj);
|
||||
|
||||
game->Render();
|
||||
//Oyster::Graphics::Core::deviceContext->Draw(3,0);
|
||||
wchar_t title[255];
|
||||
swprintf(title, sizeof(title), L"| Pressing A: %d | \n", (int)(isPressed));
|
||||
SetWindowText(g_hWnd, title);
|
||||
|
||||
//Oyster::Graphics::Render::Rendering::Basic::EndFrame();
|
||||
|
||||
|
||||
|
||||
Oyster::Graphics::Core::swapChain->Present(0,0);
|
||||
Oyster::Graphics::API::EndFrame();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -18,13 +18,19 @@
|
|||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="L_inputClass.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="L_inputClass.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7E3990D2-3D94-465C-B58D-64A74B3ECF9B}</ProjectGuid>
|
||||
<RootNamespace>Input</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
|
|
|
@ -14,4 +14,14 @@
|
|||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="L_inputClass.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="L_inputClass.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,203 @@
|
|||
#include "L_inputclass.h"
|
||||
|
||||
InputClass::InputClass()
|
||||
{
|
||||
m_directInput = NULL;
|
||||
m_keyboard = NULL;
|
||||
m_mouse = NULL;
|
||||
}
|
||||
|
||||
InputClass::~InputClass()
|
||||
{
|
||||
// Release the mouse.
|
||||
if(m_mouse)
|
||||
{
|
||||
(m_mouse)->Unacquire();
|
||||
(m_mouse)->Release();
|
||||
(m_mouse) = NULL;
|
||||
}
|
||||
//SAFE_UNACQUIRE(m_mouse);
|
||||
|
||||
// Release the keyboard.
|
||||
if(m_keyboard)
|
||||
{
|
||||
(m_keyboard)->Unacquire();
|
||||
(m_keyboard)->Release();
|
||||
(m_keyboard) = NULL;
|
||||
}
|
||||
//SAFE_UNACQUIRE(m_keyboard);
|
||||
|
||||
// Release the main interface to direct input.
|
||||
if( m_directInput )
|
||||
{
|
||||
(m_directInput)->Release();
|
||||
(m_directInput) = NULL;
|
||||
}
|
||||
//SAFE_RELEASE(m_directInput);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int screenHeight)
|
||||
{
|
||||
HRESULT result;
|
||||
|
||||
// Initialize the main direct input interface.
|
||||
result = DirectInput8Create(hinstance, DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&m_directInput, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize the direct input interface for the keyboard.
|
||||
result = m_directInput->CreateDevice(GUID_SysKeyboard, &m_keyboard, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the cooperative level of the keyboard to not share with other programs.
|
||||
result = m_keyboard->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
|
||||
if(FAILED(result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Set the data format. In this case since it is a keyboard we can use the predefined data format.
|
||||
result = m_keyboard->SetDataFormat(&c_dfDIKeyboard);
|
||||
if(FAILED(result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now acquire the keyboard.
|
||||
result = m_keyboard->Acquire();
|
||||
if(FAILED(result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize the direct input interface for the mouse.
|
||||
result = m_directInput->CreateDevice(GUID_SysMouse, &m_mouse, NULL);
|
||||
if(FAILED(result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the data format for the mouse using the pre-defined mouse data format.
|
||||
result = m_mouse->SetDataFormat(&c_dfDIMouse);
|
||||
if(FAILED(result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the cooperative level of the mouse to share with other programs.
|
||||
result = m_mouse->SetCooperativeLevel(hwnd, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE);
|
||||
if(FAILED(result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Acquire the mouse.
|
||||
result = m_mouse->Acquire();
|
||||
if(FAILED(result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputClass::Update()
|
||||
{
|
||||
bool result;
|
||||
|
||||
//Read the current state of the keyboard.
|
||||
result = ReadKeyboard();
|
||||
if(!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Read the current state of the mouse.
|
||||
result = ReadMouse();
|
||||
if(!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputClass::ReadKeyboard()
|
||||
{
|
||||
HRESULT result;
|
||||
|
||||
// Read the keyboard device.
|
||||
result = m_keyboard->GetDeviceState(sizeof(m_keyboardState), (LPVOID)&m_keyboardState);
|
||||
if(FAILED(result))
|
||||
{
|
||||
// If the keyboard lost focus or was not acquired then try to get control back.
|
||||
if((result == DIERR_INPUTLOST) || (result == DIERR_NOTACQUIRED))
|
||||
{
|
||||
m_keyboard->Acquire();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InputClass::ReadMouse()
|
||||
{
|
||||
HRESULT result;
|
||||
|
||||
// Read the mouse device.
|
||||
result = m_mouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&m_mouseState);
|
||||
if(FAILED(result))
|
||||
{
|
||||
// If the mouse lost focus or was not acquired then try to get control back.
|
||||
if((result == DIERR_INPUTLOST) || (result == DIERR_NOTACQUIRED))
|
||||
{
|
||||
m_mouse->Acquire();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InputClass::MouseMove(float &Pitch, float &RotateY )
|
||||
{
|
||||
//if left mouse button is pressed
|
||||
if (m_mouseState.rgbButtons[0])
|
||||
{
|
||||
float dx = (static_cast<float>( m_mouseState.lX)/150);
|
||||
float dy = (static_cast<float>( m_mouseState.lY)/150);
|
||||
|
||||
//
|
||||
Pitch=dy;
|
||||
RotateY=dx;
|
||||
|
||||
}
|
||||
}
|
||||
bool InputClass::IsMousePressed()
|
||||
{
|
||||
if (m_mouseState.rgbButtons[0])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool InputClass::IsKeyPressed(int key)
|
||||
{
|
||||
if( m_keyboardState[key] & 0x80 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef _INPUTCLASS_H_
|
||||
#define _INPUTCLASS_H_
|
||||
|
||||
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
|
||||
#pragma comment(lib, "dinput8.lib")
|
||||
#pragma comment(lib, "dxguid.lib")
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
|
||||
|
||||
class InputClass
|
||||
{
|
||||
private:
|
||||
IDirectInput8* m_directInput;
|
||||
IDirectInputDevice8* m_keyboard;
|
||||
IDirectInputDevice8* m_mouse;
|
||||
|
||||
unsigned char m_keyboardState[256];
|
||||
DIMOUSESTATE m_mouseState;
|
||||
|
||||
bool ReadKeyboard();
|
||||
bool ReadMouse();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
InputClass();
|
||||
~InputClass();
|
||||
|
||||
// Initialize DirectInput8Create and acquire the mouse and keyboard
|
||||
bool Initialize(HINSTANCE, HWND, int, int);
|
||||
|
||||
//read the mouse and keyboard and send back
|
||||
// delta mouse pos and if any button is pressed
|
||||
bool Update();
|
||||
|
||||
bool IsKeyPressed(int key);
|
||||
bool IsMousePressed();
|
||||
void MouseMove(float &Pitch, float &RoateY);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -29,7 +29,7 @@ namespace LinearAlgebra
|
|||
Matrix2x2( );
|
||||
Matrix2x2( const ScalarType &m11, const ScalarType &m12,
|
||||
const ScalarType &m21, const ScalarType &m22 );
|
||||
Matrix2x2( const Vector2<ScalarType> vec[2] );
|
||||
explicit Matrix2x2( const Vector2<ScalarType> vec[2] );
|
||||
Matrix2x2( const Vector2<ScalarType> &vec1, const Vector2<ScalarType> &vec2 );
|
||||
explicit Matrix2x2( const ScalarType element[4] );
|
||||
Matrix2x2( const Matrix2x2<ScalarType> &matrix );
|
||||
|
@ -80,7 +80,7 @@ namespace LinearAlgebra
|
|||
Matrix3x3( const ScalarType &m11, const ScalarType &m12, const ScalarType &m13,
|
||||
const ScalarType &m21, const ScalarType &m22, const ScalarType &m23,
|
||||
const ScalarType &m31, const ScalarType &m32, const ScalarType &m33 );
|
||||
Matrix3x3( const Vector3<ScalarType> vec[3] );
|
||||
explicit Matrix3x3( const Vector3<ScalarType> vec[3] );
|
||||
Matrix3x3( const Vector3<ScalarType> &vec1, const Vector3<ScalarType> &vec2, const Vector3<ScalarType> &vec3 );
|
||||
explicit Matrix3x3( const ScalarType element[9] );
|
||||
Matrix3x3( const Matrix3x3<ScalarType> &matrix );
|
||||
|
@ -132,7 +132,7 @@ namespace LinearAlgebra
|
|||
const ScalarType &m21, const ScalarType &m22, const ScalarType &m23, const ScalarType &m24,
|
||||
const ScalarType &m31, const ScalarType &m32, const ScalarType &m33, const ScalarType &m34,
|
||||
const ScalarType &m41, const ScalarType &m42, const ScalarType &m43, const ScalarType &m44 );
|
||||
Matrix4x4( const Vector4<ScalarType> vec[4] );
|
||||
explicit Matrix4x4( const Vector4<ScalarType> vec[4] );
|
||||
Matrix4x4( const Vector4<ScalarType> &vec1, const Vector4<ScalarType> &vec2, const Vector4<ScalarType> &vec3, const Vector4<ScalarType> &vec4 );
|
||||
explicit Matrix4x4( const ScalarType element[16] );
|
||||
Matrix4x4( const Matrix4x4<ScalarType> &matrix );
|
||||
|
|
|
@ -8,13 +8,19 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
Box::Box( )
|
||||
: ICollideable(Type_box), rotation(Float4x4::identity), center(0.0f), boundingOffset(0.5f)
|
||||
{}
|
||||
Box::Box( ) : ICollideable(Type_box)
|
||||
{
|
||||
this->rotation = Float4x4::identity;
|
||||
this->center =0.0f;
|
||||
this->boundingOffset = Float3(0.5f);
|
||||
}
|
||||
|
||||
Box::Box( const Float4x4 &r, const Float3 &p, const Float3 &s )
|
||||
: ICollideable(Type_box), rotation(r), center(p), boundingOffset(s*0.5)
|
||||
{}
|
||||
Box::Box( const Float4x4 &r, const Float3 &p, const Float3 &s ) : ICollideable(Type_box)
|
||||
{
|
||||
this->rotation = r;
|
||||
this->center = p;
|
||||
this->boundingOffset = Float3(s*0.5);
|
||||
}
|
||||
|
||||
Box::~Box( ) {}
|
||||
|
||||
|
|
|
@ -8,10 +8,24 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
BoxAxisAligned::BoxAxisAligned( ) : ICollideable(Type_box_axis_aligned), minVertex(-0.5f,-0.5f,-0.5f), maxVertex(0.5f,0.5f,0.5f) {}
|
||||
BoxAxisAligned::BoxAxisAligned( const Float3 &_minVertex, const Float3 &_maxVertex ) : ICollideable(Type_box_axis_aligned), minVertex(_minVertex), maxVertex(_maxVertex) {}
|
||||
BoxAxisAligned::BoxAxisAligned( const Float &leftClip, const Float &rightClip, const Float &topClip, const Float &bottomClip, const Float &nearClip, const Float &farClip )
|
||||
: ICollideable(Type_box_axis_aligned), minVertex(leftClip, bottomClip, nearClip), maxVertex(rightClip, topClip, farClip) {}
|
||||
BoxAxisAligned::BoxAxisAligned( ) : ICollideable(Type_box_axis_aligned)
|
||||
{
|
||||
this->minVertex = Float3(-0.5f,-0.5f,-0.5f );
|
||||
this->maxVertex = Float3( 0.5f, 0.5f, 0.5f );
|
||||
}
|
||||
|
||||
BoxAxisAligned::BoxAxisAligned( const Float3 &_minVertex, const Float3 &_maxVertex ) : ICollideable(Type_box_axis_aligned)
|
||||
{
|
||||
this->minVertex = _minVertex;
|
||||
this->maxVertex = _maxVertex;
|
||||
}
|
||||
|
||||
BoxAxisAligned::BoxAxisAligned( const Float &leftClip, const Float &rightClip, const Float &topClip, const Float &bottomClip, const Float &nearClip, const Float &farClip ) : ICollideable(Type_box_axis_aligned)
|
||||
{
|
||||
this->minVertex = Float3( leftClip, bottomClip, nearClip );
|
||||
this->maxVertex = Float3( rightClip, topClip, farClip );
|
||||
}
|
||||
|
||||
BoxAxisAligned::~BoxAxisAligned( ) {}
|
||||
|
||||
BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box )
|
||||
|
@ -22,7 +36,9 @@ BoxAxisAligned & BoxAxisAligned::operator = ( const BoxAxisAligned &box )
|
|||
}
|
||||
|
||||
::Utility::DynamicMemory::UniquePointer<ICollideable> BoxAxisAligned::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new BoxAxisAligned(*this) ); }
|
||||
{
|
||||
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new BoxAxisAligned(*this) );
|
||||
}
|
||||
|
||||
bool BoxAxisAligned::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
|
|
|
@ -74,13 +74,22 @@ namespace PrivateStatic
|
|||
}
|
||||
}
|
||||
|
||||
Frustrum::Frustrum() : ICollideable(Type_frustrum),
|
||||
leftPlane(Float3::standard_unit_x, -0.5f), rightPlane(-Float3::standard_unit_x, 0.5f),
|
||||
bottomPlane(Float3::standard_unit_y, -0.5f), topPlane(-Float3::standard_unit_y, 0.5f),
|
||||
nearPlane(Float3::standard_unit_z, -0.5f), farPlane(-Float3::standard_unit_z, 0.5f) {}
|
||||
Frustrum::Frustrum() : ICollideable(Type_frustrum)
|
||||
{
|
||||
this->leftPlane = Plane( Float3::standard_unit_x, -0.5f );
|
||||
this->rightPlane = Plane(-Float3::standard_unit_x, 0.5f ),
|
||||
this->bottomPlane = Plane( Float3::standard_unit_y, -0.5f );
|
||||
this->topPlane = Plane(-Float3::standard_unit_y, 0.5f );
|
||||
this->nearPlane = Plane( Float3::standard_unit_z, -0.5f );
|
||||
this->farPlane = Plane(-Float3::standard_unit_z, 0.5f );
|
||||
}
|
||||
|
||||
Frustrum::Frustrum( const Float4x4 &vp ) : ICollideable(Type_frustrum)
|
||||
{ PrivateStatic::VP_ToPlanes( this->leftPlane, this->rightPlane, this->bottomPlane, this->topPlane, this->nearPlane, this->farPlane, vp ); }
|
||||
{
|
||||
PrivateStatic::VP_ToPlanes( this->leftPlane, this->rightPlane, this->bottomPlane,
|
||||
this->topPlane, this->nearPlane, this->farPlane,
|
||||
vp );
|
||||
}
|
||||
|
||||
Frustrum::~Frustrum() {}
|
||||
|
||||
|
|
|
@ -6,7 +6,5 @@
|
|||
|
||||
using namespace ::Oyster::Collision3D;
|
||||
|
||||
ICollideable::ICollideable( Type _type )
|
||||
: type(_type) {}
|
||||
|
||||
ICollideable::ICollideable( Type _type ) : type(_type) {}
|
||||
ICollideable::~ICollideable() {}
|
|
@ -8,9 +8,24 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
Line::Line( ) : ICollideable(Type_line), ray(), length(0.0f) {}
|
||||
Line::Line( const class Ray &_ray, const Float &_length ) : ICollideable(Type_line), ray(_ray), length(_length) {}
|
||||
Line::Line( const Float3 &origin, const Float3 &normalizedDirection, const Float &_length ) : ICollideable(Type_line), ray(origin, normalizedDirection), length(_length) {}
|
||||
Line::Line( ) : ICollideable(Type_line)
|
||||
{
|
||||
this->ray = Ray();
|
||||
this->length = 0.0f;
|
||||
}
|
||||
|
||||
Line::Line( const class Ray &_ray, const Float &_length ) : ICollideable(Type_line)
|
||||
{
|
||||
this->ray = _ray;
|
||||
this->length = _length;
|
||||
}
|
||||
|
||||
Line::Line( const Float3 &origin, const Float3 &normalizedDirection, const Float &_length ) : ICollideable(Type_line)
|
||||
{
|
||||
this->ray = Ray( origin, normalizedDirection );
|
||||
this->length = _length;
|
||||
}
|
||||
|
||||
Line::~Line( ) {}
|
||||
|
||||
Line & Line::operator = ( const Line &line )
|
||||
|
|
|
@ -8,8 +8,18 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math;
|
||||
|
||||
Plane::Plane( ) : ICollideable(Type_plane), normal(), phasing(0.0f) {}
|
||||
Plane::Plane( const Float3 &n, const Float &p ) : ICollideable(Type_plane), normal(n), phasing(p) {}
|
||||
Plane::Plane( ) : ICollideable(Type_plane)
|
||||
{
|
||||
this->normal = Float3::standard_unit_z;
|
||||
this->phasing = 0.0f;
|
||||
}
|
||||
|
||||
Plane::Plane( const Float3 &n, const Float &p ) : ICollideable(Type_plane)
|
||||
{
|
||||
this->normal = n;
|
||||
this->phasing = p;
|
||||
}
|
||||
|
||||
Plane::~Plane( ) {}
|
||||
|
||||
Plane & Plane::operator = ( const Plane &plane )
|
||||
|
|
|
@ -8,8 +8,16 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
Point::Point( ) : ICollideable(Type_point), center() {}
|
||||
Point::Point( const Float3 &pos ) : ICollideable(Type_point), center(pos) {}
|
||||
Point::Point( ) : ICollideable(Type_point)
|
||||
{
|
||||
this->center = Float3::null;
|
||||
}
|
||||
|
||||
Point::Point( const Float3 &pos ) : ICollideable(Type_point)
|
||||
{
|
||||
this->center = pos;
|
||||
}
|
||||
|
||||
Point::~Point( ) {}
|
||||
|
||||
Point & Point::operator = ( const Point &point )
|
||||
|
@ -19,7 +27,9 @@ Point & Point::operator = ( const Point &point )
|
|||
}
|
||||
|
||||
::Utility::DynamicMemory::UniquePointer<ICollideable> Point::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Point(*this) ); }
|
||||
{
|
||||
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Point(*this) );
|
||||
}
|
||||
|
||||
bool Point::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
|
|
|
@ -8,8 +8,20 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math3D;
|
||||
|
||||
Ray::Ray( ) : ICollideable(Type_ray), origin(), direction(), collisionDistance(0.0f) {}
|
||||
Ray::Ray( const Float3 &o, const ::Oyster::Math::Float3 &d ) : ICollideable(Type_ray), origin(o), direction(d), collisionDistance(0.0f) {}
|
||||
Ray::Ray( ) : ICollideable(Type_ray)
|
||||
{
|
||||
this->origin = Float3::null;
|
||||
this->direction = Float3::standard_unit_z;
|
||||
this->collisionDistance = 0.0f;
|
||||
}
|
||||
|
||||
Ray::Ray( const Float3 &o, const ::Oyster::Math::Float3 &d ) : ICollideable(Type_ray)
|
||||
{
|
||||
this->origin = o;
|
||||
this->direction = d;
|
||||
this->collisionDistance = 0.0f;
|
||||
}
|
||||
|
||||
Ray::~Ray( ) {}
|
||||
|
||||
Ray & Ray::operator = ( const Ray &ray )
|
||||
|
@ -20,7 +32,9 @@ Ray & Ray::operator = ( const Ray &ray )
|
|||
}
|
||||
|
||||
::Utility::DynamicMemory::UniquePointer<ICollideable> Ray::Clone( ) const
|
||||
{ return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Ray(*this) ); }
|
||||
{
|
||||
return ::Utility::DynamicMemory::UniquePointer<ICollideable>( new Ray(*this) );
|
||||
}
|
||||
|
||||
bool Ray::Intersects( const ICollideable &target ) const
|
||||
{
|
||||
|
|
|
@ -4,8 +4,18 @@
|
|||
using namespace ::Oyster::Collision3D;
|
||||
using namespace ::Oyster::Math;
|
||||
|
||||
Sphere::Sphere( ) : ICollideable(Type_sphere), center(), radius(0.0f) { }
|
||||
Sphere::Sphere( const Float3 &_position, const Float &_radius ) : ICollideable(Type_sphere), center(_position), radius(_radius) {}
|
||||
Sphere::Sphere( ) : ICollideable(Type_sphere)
|
||||
{
|
||||
this->center = Float3::null;
|
||||
this->radius = 0.0f;
|
||||
}
|
||||
|
||||
Sphere::Sphere( const Float3 &_position, const Float &_radius ) : ICollideable(Type_sphere)
|
||||
{
|
||||
this->center = _position;
|
||||
this->radius = _radius;
|
||||
}
|
||||
|
||||
Sphere::~Sphere( ) {}
|
||||
|
||||
Sphere & Sphere::operator = ( const Sphere &sphere )
|
||||
|
|
Loading…
Reference in New Issue