Skip to content
Merged
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
8 changes: 4 additions & 4 deletions dev/msvc/olcPGE3_BuildSH/olcPGE3_BuildSH.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@
<ClCompile Include="..\..\..\examples\olcPGE3_Pixels.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\examples\olcPGE3_Polygons.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
Expand All @@ -164,8 +164,8 @@
<ClCompile Include="..\..\..\examples\olcPGE3_Camera2D_Tiles.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\examples\olcPGE3_Touch.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
Expand Down
20 changes: 18 additions & 2 deletions dev/src/draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,26 @@ GPUTask olc::Draw::TaskDrawLine(const std::vector<olc::vf2d>& vPoints, const olc

}

GPUTask olc::Draw::TaskDrawPoints(const std::vector<olc::vf2d>& vPoints, const std::vector<olc::Pixel>& vColours, const olc::Pixel tint)
{
GPUTask task;
task.structure = olc::Structure::Point;
task.vertexBuffer.resize(vPoints.size());
for (size_t i = 0; i < vPoints.size(); i++)
{
task.vertexBuffer[i] = { { vPoints[i].x, vPoints[i].y, 1.0f, 1.0f }, vColours[i],{ 0, 0 },{ 0, 0 },{ 0, 0 },{ 0, 0 } };
}
task.blendmode = blendMode;
task.tint = tint;
return task;
}

GPUTask olc::Draw::TaskDrawPolygon(olc::Structure structure, const std::vector<olc::vf2d>& vPoints, const std::vector<olc::Pixel>& vColours, const olc::Pixel tint)
{
olc_IgnoreUnused(structure);
return TaskDrawLine(vPoints, vColours, tint, false, true);
if (structure == olc::Structure::Point)
return TaskDrawPoints(vPoints, vColours, tint);
else
return TaskDrawLine(vPoints, vColours, tint, false, true);
}

GPUTask olc::Draw::TaskDrawPolygon(olc::Structure structure, const std::vector<olc::vf2d>& vPoints, const olc::Pixel colour, const olc::Pixel tint)
Expand Down
5 changes: 5 additions & 0 deletions dev/src/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,11 @@ namespace olc
const olc::Pixel tint = olc::Colour::WHITE,
const bool constrain = true,
const bool looped = false);

GPUTask TaskDrawPoints(
const std::vector<olc::vf2d>& vPoints,
const std::vector<olc::Pixel>& vColours,
const olc::Pixel tint = olc::Colour::WHITE);

GPUTask TaskDrawPolygon(
olc::Structure structure,
Expand Down
2 changes: 2 additions & 0 deletions dev/src/gpu_opengl33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ out vec4 oCol;
R"(
void main()
{
gl_PointSize = 1.0; // Required for emscripten

if (pgeDrawType == 2) // 3D
{
gl_Position = pgeMVP * vec4(aPos.x, aPos.y, aPos.z, 1.0);
Expand Down
5 changes: 5 additions & 0 deletions dev/src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ namespace olc
return region({ 0,0 }, this->Size()).flipH();
}

olc::ImageRegion Image::flipD()
{
return olc::ImageRegion(*this, { 0,0 }, { 0,1 }, { 1, 0 }, { 1,1 });
}

void Image::BindGPU()
{
onGPU = true;
Expand Down
1 change: 1 addition & 0 deletions dev/src/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ namespace olc
olc::ImageRegion region(const olc::vf2d& vTL, const olc::vf2d& vTR, const olc::vf2d& vBL, const olc::vf2d& vBR);
olc::ImageRegion flipV();
olc::ImageRegion flipH();
olc::ImageRegion flipD();

public: // Make friendly private later
void BindGPU();
Expand Down
33 changes: 31 additions & 2 deletions olcPixelGameEngine3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2385,6 +2385,7 @@ namespace olc
olc::ImageRegion region(const olc::vf2d& vTL, const olc::vf2d& vTR, const olc::vf2d& vBL, const olc::vf2d& vBR);
olc::ImageRegion flipV();
olc::ImageRegion flipH();
olc::ImageRegion flipD();

public: // Make friendly private later
void BindGPU();
Expand Down Expand Up @@ -3651,6 +3652,11 @@ namespace olc
const olc::Pixel tint = olc::Colour::WHITE,
const bool constrain = true,
const bool looped = false);

GPUTask TaskDrawPoints(
const std::vector<olc::vf2d>& vPoints,
const std::vector<olc::Pixel>& vColours,
const olc::Pixel tint = olc::Colour::WHITE);

GPUTask TaskDrawPolygon(
olc::Structure structure,
Expand Down Expand Up @@ -16716,6 +16722,8 @@ out vec4 oCol;
R"(
void main()
{
gl_PointSize = 1.0; // Required for emscripten

if (pgeDrawType == 2) // 3D
{
gl_Position = pgeMVP * vec4(aPos.x, aPos.y, aPos.z, 1.0);
Expand Down Expand Up @@ -18396,10 +18404,26 @@ GPUTask olc::Draw::TaskDrawLine(const std::vector<olc::vf2d>& vPoints, const olc

}

GPUTask olc::Draw::TaskDrawPoints(const std::vector<olc::vf2d>& vPoints, const std::vector<olc::Pixel>& vColours, const olc::Pixel tint)
{
GPUTask task;
task.structure = olc::Structure::Point;
task.vertexBuffer.resize(vPoints.size());
for (size_t i = 0; i < vPoints.size(); i++)
{
task.vertexBuffer[i] = { { vPoints[i].x, vPoints[i].y, 1.0f, 1.0f }, vColours[i],{ 0, 0 },{ 0, 0 },{ 0, 0 },{ 0, 0 } };
}
task.blendmode = blendMode;
task.tint = tint;
return task;
}

GPUTask olc::Draw::TaskDrawPolygon(olc::Structure structure, const std::vector<olc::vf2d>& vPoints, const std::vector<olc::Pixel>& vColours, const olc::Pixel tint)
{
olc_IgnoreUnused(structure);
return TaskDrawLine(vPoints, vColours, tint, false, true);
if (structure == olc::Structure::Point)
return TaskDrawPoints(vPoints, vColours, tint);
else
return TaskDrawLine(vPoints, vColours, tint, false, true);
}

GPUTask olc::Draw::TaskDrawPolygon(olc::Structure structure, const std::vector<olc::vf2d>& vPoints, const olc::Pixel colour, const olc::Pixel tint)
Expand Down Expand Up @@ -20679,6 +20703,11 @@ namespace olc
return region({ 0,0 }, this->Size()).flipH();
}

olc::ImageRegion Image::flipD()
{
return olc::ImageRegion(*this, { 0,0 }, { 0,1 }, { 1, 0 }, { 1,1 });
}

void Image::BindGPU()
{
onGPU = true;
Expand Down
Loading