Stable Dll read, unstable Pos

This commit is contained in:
lanariel 2013-11-26 15:33:05 +01:00
parent 2de2ef9cd0
commit f9d9479dad
22 changed files with 105 additions and 46 deletions

Binary file not shown.

BIN
Bin/DLL/DebugPixel.cso Normal file

Binary file not shown.

BIN
Bin/DLL/DebugVertex.cso Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Bin/DLL/PixelGatherData.cso Normal file

Binary file not shown.

Binary file not shown.

View File

@ -148,7 +148,6 @@
<ItemGroup>
<ClCompile Include="Resource\Loaders\ByteLoader.cpp" />
<ClCompile Include="Resource\Loaders\CustomLoader.cpp" />
<ClCompile Include="MainTest.cpp" />
<ClCompile Include="Resource\OResourceHandler.cpp" />
<ClCompile Include="Resource\OResource.cpp" />
<ClCompile Include="Utilities.cpp" />

View File

@ -33,9 +33,6 @@
<ClCompile Include="Resource\Loaders\CustomLoader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MainTest.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Utilities.h">

View File

@ -103,8 +103,8 @@ namespace Oyster
desc.BufferDesc.RefreshRate.Denominator=1;
desc.BufferDesc.RefreshRate.Numerator=60;
desc.BufferDesc.Height = Size.y;
desc.BufferDesc.Width = Size.x;
desc.BufferDesc.Height = (UINT)Size.y;
desc.BufferDesc.Width = (UINT)Size.x;
if(Core::swapChain)
{
@ -180,8 +180,8 @@ namespace Oyster
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
desc.CPUAccessFlags=0;
desc.MiscFlags=0;
desc.Height = Size.y;
desc.Width = Size.x;
desc.Height = (UINT)Size.y;
desc.Width = (UINT)Size.x;
if(Core::depthStencil)
{

View File

@ -2,13 +2,16 @@
#include "../Core/Core.h"
#include "../Render/Resources/Resources.h"
#include "../Render/Rendering/Render.h"
#include "../FileLoader/ObjReader.h"
namespace Oyster
{
namespace Graphics
{
API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen)
API::State API::Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Math::Float2 resulotion)
{
Core::resolution = resulotion;
if(Core::Init::FullInit(Window, MSAA_Quality, Fullscreen) == Core::Init::Fail)
{
return API::Fail;
@ -17,6 +20,8 @@ namespace Oyster
{
return API::Fail;
}
Render::Preparations::Basic::SetViewPort();
return API::Sucsess;
}
@ -30,5 +35,32 @@ namespace Oyster
Render::Rendering::Basic::RenderScene(models,count);
}
void API::EndFrame()
{
Render::Rendering::Basic::EndFrame();
}
API::State API::SetOptions(API::Option option)
{
return API::Sucsess;
}
Model::Model* API::CreateModel(std::wstring filename)
{
Model::Model* m = new Model::Model();
m->WorldMatrix = Oyster::Math::Float4x4::identity;
m->Visible = true;
OBJReader or;
or.readOBJFile(filename);
m->info = or.toModel();
return m;
}
void API::DeleteModel(Model::Model* model)
{
delete model;
}
}
}

View File

@ -4,12 +4,18 @@
#include "OysterMath.h"
#include <Windows.h>
#if defined GFX_DLL_EXPORT
#define GFX_DLL_USAGE __declspec(dllexport)
#else
#define GFX_DLL_USAGE __declspec(dllimport)
#endif
namespace Oyster
{
namespace Graphics
{
class API
class GFX_DLL_USAGE API
{
public:
enum State
@ -21,7 +27,7 @@ namespace Oyster
{
};
State Init(HWND Window, bool MSAA_Quality, bool Fullscreen);
static State Init(HWND Window, bool MSAA_Quality, bool Fullscreen, Oyster::Math::Float2 StartResulotion);
//! @brief from Oyster::Math Float4x4, expects corect methods
static void NewFrame(Oyster::Math::Float4x4 View, Oyster::Math::Float4x4 Projection);
static void RenderScene(Oyster::Graphics::Model::Model* models, int count);

View File

@ -1,6 +1,7 @@
#pragma once
#ifndef Mesh_h
#define Mesh_h
#include "OysterMath.h"
namespace Oyster
{
@ -10,6 +11,7 @@ namespace Oyster
{
struct Model
{
//! do not Edit, linked to render data
void* info;
Oyster::Math::Float4x4 WorldMatrix;
bool Visible;

View File

@ -24,7 +24,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
@ -66,22 +66,22 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
<OutDir>$(SolutionDir)..\Bin\DLL\</OutDir>
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
</PropertyGroup>
@ -91,6 +91,7 @@
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)OysterMath;$(SolutionDir)Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>GFX_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -105,6 +106,7 @@
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\OysterPhysic3D\Collision;..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>GFX_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -118,6 +120,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>GFX_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -133,6 +136,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\OysterPhysics3D;..\OysterMath;..\Misc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>GFX_DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -7,12 +7,9 @@
//--------------------------------------------------------------------------------------
#define NOMINMAX
#include <Windows.h>
#include "Core/Core.h"
#include "Render\Preparations\Preparations.h"
#include "Render\Resources\Resources.h"
#include "Render\Rendering\Render.h"
#include "FileLoader\ObjReader.h"
#include "Definitions\GraphicalDefinition.h"
#include "DllInterfaces\GFXAPI.h"
//--------------------------------------------------------------------------------------
// Global Variables
@ -42,6 +39,22 @@ HRESULT InitDirect3D();
//--------------------------------------------------------------------------------------
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{
bool b = SetDllDirectoryW(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 params;
params.dwReserved=NULL;
params.lpCmdLine="";
params.lpCmdShow="";
params.lpEnvAddress="";
LoadModule("OysterGraphics_x86D.dll",&params);
if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
return 0;
@ -138,15 +151,10 @@ HRESULT InitDirect3D()
{
HRESULT hr = S_OK;;
Oyster::Graphics::Core::resolution = Oyster::Math::Float2( 1024, 768 );
if(Oyster::Graphics::Core::Init::FullInit(g_hWnd,false,false)==Oyster::Graphics::Core::Init::Fail)
if(Oyster::Graphics::API::Init(g_hWnd,false,false, Oyster::Math::Float2( 1024, 768 )) == Oyster::Graphics::API::Fail)
{
return E_FAIL;
//Init shaders
Oyster::Graphics::Render::Resources::Init();
Oyster::Graphics::Render::Preparations::Basic::SetViewPort();
}
#pragma region Triangle
//Oyster::Graphics::Definitions::ObjVertex mesh[] =
@ -176,15 +184,12 @@ HRESULT InitDirect3D()
#pragma endregion
#pragma region Obj
OBJReader or;
or.readOBJFile(L"crate.obj");
m->info = (void*)or.toModel();
m->Visible=true;
m = Oyster::Graphics::API::CreateModel(L"bth.obj");
m->WorldMatrix *= 0.1f;
#pragma endregion
m->WorldMatrix = Oyster::Math::Matrix::identity;
P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,16.0f/9.0f,.1f,100);
P = Oyster::Math3D::ProjectionMatrix_Perspective(Oyster::Math::pi/2,1024.0f/768.0f,.1f,100);
V = Oyster::Math3D::OrientationMatrix_LookAtDirection(Oyster::Math::Float3(0,0,-1),Oyster::Math::Float3(0,1,0),Oyster::Math::Float3(0,-1.5f,10.4f));
V = Oyster::Math3D::InverseOrientationMatrix(V);
@ -200,18 +205,11 @@ HRESULT Update(float deltaTime)
HRESULT Render(float deltaTime)
{
Oyster::Graphics::Render::Rendering::Basic::NewFrame(V,P);
//Oyster::Graphics::Render::Preparations::Basic::ClearBackBuffer(Oyster::Math::Float4(0,0,1,1));
Oyster::Graphics::API::NewFrame(V,P);
//m->info->Vertices->Apply(0);
Oyster::Graphics::API::RenderScene(m,1);
//Oyster::Graphics::Core::deviceContext->Draw(3,0);
//Oyster::Graphics::Core::swapChain->Present(0,0);
Oyster::Graphics::Render::Rendering::Basic::RenderScene(m,1);
Oyster::Graphics::Render::Rendering::Basic::EndFrame();
Oyster::Graphics::API::EndFrame();
return S_OK;
}

View File

@ -103,7 +103,14 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DelayLoadDLLs>OysterGraphics_x86D.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
</Link>
<ProjectReference>
<LinkLibraryDependencies>
</LinkLibraryDependencies>
</ProjectReference>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@ -118,6 +125,9 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName)D.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -136,6 +146,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -154,6 +167,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>OysterGraphics_$(PlatformShortName).lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)..\Bin\DLL;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<PreventDllBinding>true</PreventDllBinding>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@ -165,6 +181,11 @@
</ProjectReference>
<ProjectReference Include="..\OysterGraphics\OysterGraphics.vcxproj">
<Project>{0ec83e64-230e-48ef-b08c-6ac9651b4f82}</Project>
<Private>false</Private>
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
<ProjectReference Include="..\OysterMath\OysterMath.vcxproj">
<Project>{f10cbc03-9809-4cba-95d8-327c287b18ee}</Project>