Menu

[025cc2]: / DirectPython11 / DPDeviceState.hpp  Maximize  Restore  History

Download this file

87 lines (65 with data), 2.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
Copyright (C) 2010, Heikki Salo
All rights reserved.
Distributed under the BSD license:
http://www.opensource.org/licenses/bsd-license.php
*/
#ifndef DP_DEVICESTATE_HPP
#define DP_DEVICESTATE_HPP
#include "stdafx.h"
#include "DPBase.hpp"
class DPDeviceState : DPBase {
public:
~DPDeviceState();
DPDeviceState();
DPDeviceState(ID3D11DepthStencilState*);
DPDeviceState(ID3D11BlendState*);
DPDeviceState(ID3D11RasterizerState*);
DPDeviceState(ID3D11SamplerState*);
void release();
DPDeviceState* combine(DPDeviceState&);
ID3D11DepthStencilState* getDepthStencilState() { return depthStencilState; }
ID3D11BlendState* getBlendState() { return blendState; }
ID3D11RasterizerState* getRasterizerState() { return rasterizerState; }
ID3D11SamplerState* getSamplerState() { return samplerState; }
void stealDepthStencilState(ID3D11DepthStencilState* state) {
assert(depthStencilState == 0);
depthStencilState = state;
}
void stealBlendState(ID3D11BlendState* state) {
assert(blendState == 0);
blendState = state;
}
void stealRasterizerState(ID3D11RasterizerState* state) {
assert(rasterizerState == 0);
rasterizerState = state;
}
bool hasDepthStencilState() { return depthStencilState != 0;}
bool hasBlendState() { return blendState != 0; }
bool hasRasterizerState() { return rasterizerState != 0; }
bool hasSamplerState() { return samplerState != 0; }
void setStencilRef(UINT sref) { stencilRef = sref; }
UINT getStencilRef() { return stencilRef; }
python::object getBlendFactorPy() { return python::make_tuple(blendFactor[0], blendFactor[1], blendFactor[2], blendFactor[3]); }
void setBlendFactorPy(python::object& blend) {
for (int i=0; i < 4; ++i)
blendFactor[i] = python::extract<float>(blend[i]);
}
float* getBlendFactor() { return blendFactor; }
void setBlendFactor(float blend[4]) {
for (int i=0; i < 4; ++i)
blendFactor[i] = blend[i];
}
UINT getSampleMask() { return sampleMask; }
void setSampleMask(UINT mask) { sampleMask = mask; }
private:
void zeroOut();
ID3D11DepthStencilState* depthStencilState;
UINT stencilRef;
ID3D11BlendState* blendState;
float blendFactor[4];
UINT sampleMask;
ID3D11RasterizerState* rasterizerState;
ID3D11SamplerState* samplerState;
};
#endif
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.