Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions SA2LevelEditor/SA2LevelEditor.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\entities\LevelSpecific\PyramidCave\KEYDOOR.cpp" />
<ClCompile Include="src\collision\CollisionChecker.cpp" />
<ClCompile Include="src\collision\CollisionModel.cpp" />
<ClCompile Include="src\collision\Triangle3D.cpp" />
Expand Down Expand Up @@ -268,6 +269,7 @@
<ClCompile Include="src\toolbox\Vector.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\entities\LevelSpecific\PyramidCave\KEYDOOR.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="src\collision\collisionchecker.h" />
<ClInclude Include="src\collision\collisionmodel.h" />
Expand Down
4 changes: 4 additions & 0 deletions SA2LevelEditor/SA2LevelEditor.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@
<ClCompile Include="src\entities\LevelSpecific\WeaponsBed\TRUCK.cpp">
<Filter>Source Files\entities\LevelSpecific\WeaponsBed</Filter>
</ClCompile>
<ClCompile Include="src\entities\LevelSpecific\PyramidCave\KEYDOOR.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\main\main.h">
Expand Down Expand Up @@ -752,6 +755,7 @@
<ClInclude Include="src\entities\LevelSpecific\WeaponsBed\truck.h">
<Filter>Source Files\entities\LevelSpecific\WeaponsBed</Filter>
</ClInclude>
<ClInclude Include="src\entities\LevelSpecific\PyramidCave\KEYDOOR.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="SA2LevelEditor.rc">
Expand Down
28 changes: 19 additions & 9 deletions SA2LevelEditor/res/Shaders/entity/fragmentShader.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

in vec2 pass_textureCoords;
in vec3 color;
in vec3 vBary;

out vec4 out_Color;

Expand All @@ -10,20 +11,29 @@ uniform sampler2D textureSampler2;
uniform int hasTransparency;
uniform vec3 baseColour;
uniform float mixFactor;
uniform int hasTexture;

void main(void)
{
vec4 rawTextureColour = mix(texture(textureSampler, pass_textureCoords), texture(textureSampler2, pass_textureCoords), mixFactor);
rawTextureColour.rgb *= baseColour*color;
if (hasTexture != 0) {
vec4 rawTextureColour = mix(texture(textureSampler, pass_textureCoords), texture(textureSampler2, pass_textureCoords), mixFactor);
rawTextureColour.rgb *= baseColour*color;

if (hasTransparency == 0)
{
if (rawTextureColour.a < 0.9)
if (hasTransparency == 0)
{
discard;
if (rawTextureColour.a < 0.9)
{
discard;
}
rawTextureColour.a = 1;
}
rawTextureColour.a = 1;
}

out_Color = rawTextureColour;
out_Color = rawTextureColour;
} else {
float edge = min(vBary.x, min(vBary.y, vBary.z));
if (edge < 0.01)
out_Color = vec4(0.0, 0.0, 0.0, 1.0);
else
out_Color = vec4(baseColour*color,1.0);
}
}
3 changes: 3 additions & 0 deletions SA2LevelEditor/res/Shaders/entity/vertexShader.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ in vec3 position;
in vec2 textureCoords;
in vec3 normal;
in vec3 vertexColor;
in vec3 bary;

out vec2 pass_textureCoords;
out vec3 color;
out vec3 vBary;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;
Expand All @@ -30,4 +32,5 @@ void main(void)

color = vertexColor;
color *= 0.75 + (normal.y/4);
vBary = bary;
}
32 changes: 32 additions & 0 deletions SA2LevelEditor/src/collision/collisionmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,39 @@ class SA2Object;

#include <math.h>
#include <list>
#include "../toolbox/vector.h"

struct PCMeshset {
uint16_t typeAndMaterialID;
uint16_t numMeshes;
int16_t* __ptr32 meshes;
uint32_t* __ptr32 attrA;
Vector3f* __ptr32 normals;
uint32_t* __ptr32 vertexColor;
uint32_t* __ptr32 vertexUV;
};

struct PCMeshModel {
Vector3f* __ptr32 points;
Vector3f* __ptr32 normals;
uint32_t numPoints;
struct PCMeshset* __ptr32 meshsets;
uint32_t materials;
uint16_t numMeshsets;
uint16_t numMaterials;
Vector3f center;
float radius;
};

struct PCMeshObject {
uint32_t evalFlags;
struct PCMeshModel* __ptr32 model;
Vector3f pos;
int32_t ang[3];
Vector3f scale;
struct PCMeshObject* __ptr32 child;
struct PCMeshObject* __ptr32 sibling;
};

class CollisionModel
{
Expand Down
Loading