Skip to content
This repository has been archived by the owner on Apr 19, 2018. It is now read-only.

Commit

Permalink
Fixed merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmustilljander committed Apr 17, 2013
2 parents 8f95c6f + 38bffbe commit ef2b155
Show file tree
Hide file tree
Showing 41 changed files with 120 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void Camera::SetPosition(D3DXVECTOR3 lPosition)
mPosition = lPosition;
}

//This will do something maybe, from cpp

void Camera::SetYPosition(float lY)
{
mPosition.y = lY;
Expand Down Expand Up @@ -172,4 +172,34 @@ void Camera::RebuildView()
void Camera::SetAim(D3DXVECTOR3 lAim)
{
mAim = lAim;
}


void Camera::BuildViewReflection(float lOffset)
{


//all hail www.rastertek.com/dx10tut27.html
D3DXVECTOR3 lUp, lPos, lLookat;
float lRadians;

//up vektorn
lUp = D3DXVECTOR3(0.0f, 1.0f,0.0f);

//Eftersom den ska reflektera i z-led så gör vi som vi gör med z axeln. (inverterar och gör nåt coolt med offseten(läs på detta din n00b!)

lPos.x = mPosition.x;
lPos.y = mPosition.y;
lPos.z = -mPosition.z + (lOffset * 2.0f);

//gör om rotationen till radianer
lRadians = mCameraAngleXZ * 0.0174532925f;

lLookat.x = sinf(lRadians) + mPosition.x;
lLookat.y = mPosition.y;
lLookat.z = cosf(lRadians) + mPosition.z;

D3DXMatrixLookAtLH(&mReflectionView, &lPos, &lLookat, &lUp);


}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Camera
void Strafe(float d);
void Walk(float d);

//This will do something maybe, from header file

void SetYPosition(float lY);
void Pitch(float lAngle);
void Yaw(float lAngle);
Expand All @@ -26,15 +26,18 @@ class Camera
float mCameraAngleXZ;
void Update();

void BuildViewReflection(float lOffset);
void SetAim(D3DXVECTOR3 lAim);

public:
D3DXVECTOR3 GetPosition() const { return mPosition; }
D3DXMATRIX GetViewMatrix() const { return mView; }
D3DXMATRIX GetReflectionViewMatrix() const {return mReflectionView;};
D3DXMATRIX GetProjectionMatrix() const { return mProj; }
D3DXVECTOR3 RotateY(D3DXVECTOR3 lVector, float lAngleInPI);
D3DXVECTOR3 RotateZ(D3DXVECTOR3 lVector, float lAngleInPI);


private:
D3DXVECTOR3 Translation(D3DXVECTOR3 lVector, D3DXVECTOR3 lTranslationVector);
D3DXVECTOR3 Multiply(D3DXVECTOR3 v, D3DXMATRIX& m);
Expand All @@ -46,6 +49,7 @@ class Camera
D3DXVECTOR3 mAim;
D3DXVECTOR3 mDirection;

D3DXMATRIX mReflectionView;
D3DXMATRIX mView;
D3DXMATRIX mProj;
};
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Build started 2013-04-17 17:37:18.
Build started 2013-04-17 17:50:14.
1>Project "J:\3D2_Project\DV1222 - Lab3 - Rasmus Tilljander\DV1222 - Lab3 - Rasmus Tilljander\DV1222 - Lab3 - Rasmus Tilljander.vcxproj" on node 2 (build target(s)).
1>InitializeBuildStatus:
Creating "Debug\DV1222 - Lab3 - Rasmus Tilljander.unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /I"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /ZI /nologo /W3 /WX- /Od /Oy- /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt WorldHandler.cpp
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /I"C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include" /ZI /nologo /W3 /WX- /Od /Oy- /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt ObjectBox.cpp Camera.cpp DrawableTex2D.cpp GameTimer.cpp GeneralObject.cpp Main.cpp Object.cpp ObjectFactory.cpp ObjectLoader.cpp ParticleHandler.cpp ParticleSystem.cpp Rain.cpp Renderer.cpp ResourceLoader.cpp Screen.cpp ShaderObject.cpp Sun.cpp Tree.cpp WorldHandler.cpp
WorldHandler.cpp
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\worldhandler.cpp(148): warning C4482: nonstandard extension used: enum 'LoadableObject' used in qualified name
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\worldhandler.cpp(153): warning C4305: 'argument' : truncation from 'double' to 'FLOAT'
Expand All @@ -15,6 +15,52 @@
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\worldhandler.cpp(184): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\worldhandler.cpp(189): warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\worldhandler.cpp(190): warning C4244: '=' : conversion from 'int' to 'float', possible loss of data
Tree.cpp
Sun.cpp
ShaderObject.cpp
Screen.cpp
ResourceLoader.cpp
Renderer.cpp
Rain.cpp
ParticleSystem.cpp
ParticleHandler.cpp
ObjectLoader.cpp
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(44): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(47): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(57): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(60): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(69): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(72): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(80): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(83): warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h(325) : see declaration of 'sscanf'
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(110): warning C4018: '<' : signed/unsigned mismatch
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(112): warning C4244: 'argument' : conversion from 'float' to 'unsigned int', possible loss of data
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(113): warning C4244: 'argument' : conversion from 'float' to 'unsigned int', possible loss of data
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectloader.cpp(114): warning C4244: 'argument' : conversion from 'float' to 'unsigned int', possible loss of data
ObjectFactory.cpp
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectfactory.cpp(21): warning C4482: nonstandard extension used: enum 'LoadableObject' used in qualified name
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectfactory.cpp(25): warning C4482: nonstandard extension used: enum 'LoadableObject' used in qualified name
Object.cpp
Main.cpp
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\main.cpp(130): warning C4244: '=' : conversion from 'LONG' to 'float', possible loss of data
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\main.cpp(131): warning C4244: '=' : conversion from 'LONG' to 'float', possible loss of data
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\main.cpp(133): warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\main.cpp(134): warning C4244: 'argument' : conversion from 'double' to 'float', possible loss of data
GeneralObject.cpp
GameTimer.cpp
DrawableTex2D.cpp
Camera.cpp
ObjectBox.cpp
Generating Code...
1>j:\3d2_project\dv1222 - lab3 - rasmus tilljander\dv1222 - lab3 - rasmus tilljander\objectfactory.cpp(29): warning C4715: 'ObjectFactory::LoadObject' : not all control paths return a value
Link:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"J:\3D2_Project\DV1222 - Lab3 - Rasmus Tilljander\Debug\DV1222 - Lab3 - Rasmus Tilljander.exe" /NOLOGO d3d10.lib d3dx10.lib DxErr.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Debug\DV1222 - Lab3 - Rasmus Tilljander.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"J:\3D2_Project\DV1222 - Lab3 - Rasmus Tilljander\Debug\DV1222 - Lab3 - Rasmus Tilljander.pdb" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"J:\3D2_Project\DV1222 - Lab3 - Rasmus Tilljander\Debug\DV1222 - Lab3 - Rasmus Tilljander.lib" /MACHINE:X86 Debug\ObjectBox.obj
Debug\Camera.obj
Expand All @@ -35,7 +81,6 @@
Debug\Sun.obj
Debug\Tree.obj
Debug\WorldHandler.obj
LINK : J:\3D2_Project\DV1222 - Lab3 - Rasmus Tilljander\Debug\DV1222 - Lab3 - Rasmus Tilljander.exe not found or not built by the last incremental link; performing full link
DV1222 - Lab3 - Rasmus Tilljander.vcxproj -> J:\3D2_Project\DV1222 - Lab3 - Rasmus Tilljander\Debug\DV1222 - Lab3 - Rasmus Tilljander.exe
Manifest:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mt.exe /nologo /verbose /outputresource:"J:\3D2_Project\DV1222 - Lab3 - Rasmus Tilljander\Debug\DV1222 - Lab3 - Rasmus Tilljander.exe;#1" /manifest "Debug\DV1222 - Lab3 - Rasmus Tilljander.exe.intermediate.manifest"
Expand All @@ -46,4 +91,4 @@

Build succeeded.

Time Elapsed 00:00:05.36
Time Elapsed 00:00:35.89
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.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ void DrawableTex2D::BuildColorMap()
texDesc.SampleDesc.Count = 1;
texDesc.SampleDesc.Quality = 0;
texDesc.Usage = D3D10_USAGE_DEFAULT;
texDesc.BindFlags = D3D10_BIND_RENDER_TARGET |
D3D10_BIND_SHADER_RESOURCE;
texDesc.BindFlags = D3D10_BIND_RENDER_TARGET |D3D10_BIND_SHADER_RESOURCE;
texDesc.CPUAccessFlags = 0;
texDesc.MiscFlags = D3D10_RESOURCE_MISC_GENERATE_MIPS;
if(FAILED(mDevice->CreateTexture2D(&texDesc, 0, &lColorMap)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static const float4 fogColor = float4(0.5f,0.5f,0.5f,1.0f);
static const float fogDensity = 0.03f;
float4 CalculateFogFactor(float lViewSpaceDepth)
{
return saturate((fogEnd - lViewSpaceDepth)/ (fogEnd - fogStart)) + pow(1.0f / 2.7828 ,(lViewSpaceDepth * fogDensity));
return saturate((fogEnd - lViewSpaceDepth)/ (fogEnd - fogStart)) + pow(1.0f / 2.7828 ,(lViewSpaceDepth * fogDensity)*(lViewSpaceDepth * fogDensity)*(lViewSpaceDepth * fogDensity));
}

float4 ApplyFog(float4 lTextureColor, float4 fogFactor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,11 @@ float4 PS(PixelShaderIn input) : SV_Target
input.projTexC.xyz /= input.projTexC.w;
//Fixa texturkoordinater ifrån clip space coords
float2 smTex = float2(0.5f*input.projTexC.x, -0.5f*input.projTexC.y) + 0.5f;


//om positionen inte syns från ljuset, dvs utanför dess frustrum view ( händer typ bara i kanterna)
//if( input.projTexC.x < -1.0f || input.projTexC.x > 1.0f ||
//input.projTexC.y < -1.0f || input.projTexC.y > 1.0f ||
//input.projTexC.z < 0.0f || input.projTexC.z > 1.0f ) return ambient;

float x,y;
float sum = 0;

//nästlad forloop som utför ett pcf filter på shadowmappen
//nästlad forloop som utför ett pcf filter på shadowmappen i ett 5x5 fält
for(y = - 2 ; y <= 2.0; y += 1.0f)
{
for(x = - 2 ; x <=2.0; x += 1.0f)
Expand All @@ -82,11 +76,12 @@ float4 PS(PixelShaderIn input) : SV_Target
}
}
//för att det inte ska bli så jävla ljust
float shadowCoeff = sum/16;
float shadowCoeff = sum/25;
//float shadowCoeff = gShadowMap.SampleCmpLevelZero(cmpSampler, smTex, input.projTexC.z - SHADOWBIAS);
float3 L =normalize(Sunpos - input.wPos.xyz);
float ndotl = dot(normalize(input.normalVS), L);
//atm så är det bara "normaluträknade" skuggor för shadowmapen ser förjävlig ut för att biasen e jobbig att få rätt....
//de normaluträknade skuggorna (aka de precis ovanför denna kommentaren) är mest till för att bth logan inte blir snyggt skuggad annars pga att
//shadowbiasen är lagom inte lätt att få till snyggt på den.
return ambient + a * ndotl * shadowCoeff ;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,16 @@ float4 PS(PixelShaderIn input) : SV_Target
float x,y;
float sum = 0;

//nästlad forloop som utför ett pcf filter på shadowmappen
//nästlad forloop som utför ett pcf filter på shadowmappen (5x5)
for(y = - 2 ; y <= 2.0; y += 1.0f)
{
for(x = - 2 ; x <=2.0; x += 1.0f)
{
sum += gShadowMap.SampleCmpLevelZero(cmpSampler, smTex + texOffset(x,y), input.projTexC.z - SHADOWBIAS);
}
}
//för att det inte ska bli så jävla ljust
float shadowCoeff = sum/16;
//för att det inte ska bli så jefla ljust
float shadowCoeff = sum/25;



Expand Down
Loading

0 comments on commit ef2b155

Please sign in to comment.