backlog script update + font update + gass dither update
This commit is contained in:
@@ -57,7 +57,7 @@ inline float ditherMask8(in float2 pixel)
|
||||
|
||||
inline float dither(in float2 pixel)
|
||||
{
|
||||
return ditherMask4(pixel);
|
||||
return ditherMask8(pixel);
|
||||
}
|
||||
|
||||
#endif //DITHER_HF
|
||||
|
||||
@@ -28,7 +28,8 @@ void main(
|
||||
for(uint i=0;i<1;++i){
|
||||
float4 mod = pos + float4(cross(MOD[i], normal), 0);
|
||||
#ifdef GRASS_FADE_DITHER
|
||||
const float fade = pow(saturate(distance(pos.xyz, eye.xyz) / drawdistance), 10);
|
||||
static const float grassPopDistanceThreshold = 0.9f;
|
||||
const float fade = pow(saturate(distance(pos.xyz, eye.xyz) / (drawdistance*grassPopDistanceThreshold)), 10);
|
||||
#else
|
||||
static const float fade = 0;
|
||||
#endif
|
||||
|
||||
@@ -35,7 +35,8 @@ void main(
|
||||
QGS_OUT element = (QGS_OUT)0;
|
||||
element.nor = normal;
|
||||
#ifdef GRASS_FADE_DITHER
|
||||
element.fade = pow(saturate(distance(pos.xyz, eye.xyz) / drawdistance), 10);
|
||||
static const float grassPopDistanceThreshold = 0.9f;
|
||||
element.fade = pow(saturate(distance(pos.xyz, eye.xyz) / (drawdistance*grassPopDistanceThreshold)), 10);
|
||||
#endif
|
||||
|
||||
element.tex=float2(rand%2?1:0,0);
|
||||
|
||||
@@ -16,7 +16,7 @@ int wiBackLog::scroll;
|
||||
stringstream wiBackLog::inputArea;
|
||||
int wiBackLog::historyPos=0;
|
||||
ID3D11ShaderResourceView* wiBackLog::backgroundTex = nullptr;
|
||||
|
||||
float wiBackLog::fontSize = 0;
|
||||
|
||||
void wiBackLog::Initialize(){
|
||||
pos = (float)wiRenderer::RENDERHEIGHT;
|
||||
@@ -26,9 +26,11 @@ void wiBackLog::Initialize(){
|
||||
inputArea=stringstream("");
|
||||
const unsigned char colorData[] = { 0, 0, 43, 200, 43, 31, 141, 223 };
|
||||
wiTextureHelper::CreateTexture(backgroundTex, colorData, 1, 2, 4);
|
||||
fontSize = 0;
|
||||
|
||||
wiLua::GetGlobal()->Register("backlog_clear", ClearLua);
|
||||
wiLua::GetGlobal()->Register("backlog_post", PostLua);
|
||||
wiLua::GetGlobal()->Register("backlog_fontsize", FontSizeLua);
|
||||
}
|
||||
void wiBackLog::CleanUp(){
|
||||
stream.clear();
|
||||
@@ -60,8 +62,8 @@ void wiBackLog::Draw(){
|
||||
fx.pos=XMFLOAT3(0,pos,0);
|
||||
fx.opacity = wiMath::Lerp(0, 1, pos / wiRenderer::RENDERHEIGHT);
|
||||
wiImage::Draw(backgroundTex, fx);
|
||||
wiFont(getText(), wiFontProps(5, pos - wiRenderer::RENDERHEIGHT + 75 + scroll, 0, WIFALIGN_LEFT, WIFALIGN_BOTTOM, -8)).Draw();
|
||||
wiFont(inputArea.str().c_str(), wiFontProps(5, -(float)wiRenderer::RENDERHEIGHT + 10, 0, WIFALIGN_LEFT, WIFALIGN_BOTTOM, -8)).Draw();
|
||||
wiFont(getText(), wiFontProps(5, pos - wiRenderer::RENDERHEIGHT + 75 + scroll, fontSize, WIFALIGN_LEFT, WIFALIGN_BOTTOM, -8)).Draw();
|
||||
wiFont(inputArea.str().c_str(), wiFontProps(5, -(float)wiRenderer::RENDERHEIGHT + 10, fontSize, WIFALIGN_LEFT, WIFALIGN_BOTTOM, -8)).Draw();
|
||||
//wiFont::Draw(wiBackLog::getText(), "01", XMFLOAT4(5, pos - wiRenderer::RENDERHEIGHT + 75 + scroll, 0, -8), "left", "bottom");
|
||||
//wiFont::Draw(inputArea.str().c_str(), "01", XMFLOAT4(5, -(float)wiRenderer::RENDERHEIGHT + 10, 0, -8), "left", "bottom");
|
||||
}
|
||||
@@ -164,3 +166,15 @@ int wiBackLog::PostLua(lua_State* L)
|
||||
//number of results
|
||||
return 0;
|
||||
}
|
||||
int wiBackLog::FontSizeLua(lua_State* L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
|
||||
if (argc > 0)
|
||||
{
|
||||
fontSize = lua_tointeger(L, 1);
|
||||
}
|
||||
|
||||
//number of results
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ private:
|
||||
};
|
||||
static State state;
|
||||
static ID3D11ShaderResourceView* backgroundTex;
|
||||
static float fontSize;
|
||||
public:
|
||||
static void Initialize();
|
||||
static void CleanUp();
|
||||
@@ -50,6 +51,7 @@ public:
|
||||
|
||||
static int ClearLua(lua_State* L);
|
||||
static int PostLua(lua_State* L);
|
||||
static int FontSizeLua(lua_State* L);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,14 +18,14 @@ enum wiFontAlign
|
||||
class wiFontProps
|
||||
{
|
||||
public:
|
||||
int size;
|
||||
int spacingX, spacingY;
|
||||
float size;
|
||||
float spacingX, spacingY;
|
||||
float posX, posY;
|
||||
wiFontAlign h_align, v_align;
|
||||
|
||||
//zero-based properties: add or subtract from values
|
||||
wiFontProps(float posX = 0, float posY = 0, int size = 0, wiFontAlign h_align = WIFALIGN_LEFT, wiFontAlign v_align = WIFALIGN_TOP
|
||||
, int spacingX = 0, int spacingY = 0)
|
||||
wiFontProps(float posX = 0, float posY = 0, float size = 0, wiFontAlign h_align = WIFALIGN_LEFT, wiFontAlign v_align = WIFALIGN_TOP
|
||||
, float spacingX = 0, float spacingY = 0)
|
||||
:posX(posX), posY(posY), size(size), h_align(h_align), v_align(v_align), spacingX(spacingX), spacingY(spacingY)
|
||||
{}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user