Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
Added Blend
Browse files Browse the repository at this point in the history
  • Loading branch information
Dgame committed May 25, 2015
1 parent 83b2ce3 commit 624ffb4
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
30 changes: 30 additions & 0 deletions source/Dgame/Graphic/Blend.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module Dgame.Graphic.Blend;

import derelict.opengl3.gl;

struct Blend {
static immutable Blend One = Blend(Factor.One, Factor.One);
static immutable Blend Zero = Blend(Factor.Zero, Factor.Zero);
static immutable Blend Default = Blend(Factor.SrcAlpha, Factor.OneMinusSrcAlpha);

enum Factor {
Zero = GL_ZERO,
One = GL_ONE,
SrcColor = GL_SRC_COLOR,
OneMinusSrcColor = GL_ONE_MINUS_SRC_COLOR,
DstColor = GL_DST_COLOR,
OneMinusDstColor = GL_ONE_MINUS_DST_COLOR,
SrcAlpha = GL_SRC_ALPHA,
OneMinusSrcAlpha = GL_ONE_MINUS_SRC_ALPHA,
DstAlpha = GL_DST_ALPHA,
OneMinusDstAlpha = GL_ONE_MINUS_DST_ALPHA
}

Factor srcColor = Factor.One;
Factor dstColor = Factor.Zero;

@nogc
void use() const nothrow {
glBlendFunc(this.srcColor, this.dstColor);
}
}
1 change: 1 addition & 0 deletions source/Dgame/Graphic/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Dgame.Graphic;

public:

import Dgame.Graphic.Blend;
import Dgame.Graphic.Color;
import Dgame.Graphic.Drawable;
import Dgame.Graphic.Shape;
Expand Down
10 changes: 10 additions & 0 deletions source/Dgame/docs/Blend.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html><head>
<META http-equiv="content-type" content="text/html; charset=utf-8">
<title>Dgame.Graphic.Blend</title>
</head><body>
<h1>Dgame.Graphic.Blend</h1>
<!-- Generated by Ddoc from ..\Graphic\Blend.d -->
<br><br>

<hr><small>Page generated by <a href="http://dlang.org/ddoc.html">Ddoc</a>. </small>
</body></html>
4 changes: 2 additions & 2 deletions source/Dgame/test/.dub/dub.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"dub": {
"cachedUpgrades": {
"derelict-util": "1.9.1",
"derelict-util": "2.0.0",
"derelict-sdl2": "1.9.5",
"derelict-gl3": "1.0.12"
},
"lastUpgrade": "2015-05-20T20:00:54.365836"
"lastUpgrade": "2015-05-25T23:01:37.9147614"
}
}

0 comments on commit 624ffb4

Please sign in to comment.