Skip to content
Snippets Groups Projects
Commit 0a05d1fb authored by dg's avatar dg
Browse files

shader tests

git-svn-id: http://svn.net-core.org/repos/t-engine4@833 51575b47-30f0-44d4-a5cc-537603b46e54
parent e64ff97c
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,8 @@ newBirthDescriptor{
body = { INVEN = 1000, QS_MAINHAND = 1, QS_OFFHAND = 1, MAINHAND = 1, OFFHAND = 1, FINGER = 2, NECK = 1, LITE = 1, BODY = 1, HEAD = 1, HANDS = 1, FEET = 1, TOOL = 1, QUIVER = 1 },
copy = {
shader = "unique_glow", textures = { function() local n = core.noise.new(3); return n:makeTexture3D(64, 64, 64, 0, 0, 0), true end },
-- Mages are unheard of at first, nobody but them regenerates mana
mana_rating = 6,
mana_regen = 0,
......
-- ToME - Tales of Middle-Earth
-- Copyright (C) 2009, 2010 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local Talents = require("engine.interface.ActorTalents")
newEntity{
define_as = "BASE_NPC_ORC_RAK_SHOR",
type = "humanoid", subtype = "orc",
display = "o", color=colors.DARK_GREY,
faction = "orc-pride",
combat = { dam=resolvers.rngavg(5,12), atk=2, apr=6, physspeed=2 },
body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1, QUIVER=1 },
resolvers.drops{chance=20, nb=1, {} },
resolvers.drops{chance=10, nb=1, {type="money"} },
infravision = 20,
lite = 2,
life_rating = 11,
rank = 2,
size_category = 3,
open_door = true,
autolevel = "warrior",
ai = "dumb_talented_simple", ai_state = { talent_in=3, },
energy = { mod=1 },
stats = { str=20, dex=8, mag=6, con=16 },
}
newEntity{ base = "BASE_NPC_ORC_RAK_SHOR",
name = "orc necromancer", color=colors.DARK_GREY,
desc = [[An orc dressed in black robes. He mumbles is a harsh tongue.]],
level_range = {25, nil}, exp_worth = 1,
rarity = 4,
max_life = resolvers.rngavg(70,80), life_rating = 7,
resolvers.equip{
{type="weapon", subtype="staff", autoreq=true},
{type="armor", subtype="cloth", autoreq=true},
},
combat_armor = 0, combat_def = 5,
summon = {
{type="undead", subtype="skeleton", number=1, hasxp=false},
{type="humanoid", subtype="ghoul", number=1, hasxp=false},
},
make_escort = {
{type="undead", subtype="ghoul", no_subescort=true, chance=50, number=resolvers.mbonus(3, 2)},
{type="undead", subtype="skeleton", no_subescort=true, chance=50, number=resolvers.mbonus(3, 2)},
},
resolvers.talents{
[Talents.T_SUMMON]=1,
-- [Talents.T_]=3,
},
}
uniform vec2 texSize;
//uniform vec2 texSize;
uniform sampler2D tex;
uniform sampler3D noiseVol;
uniform sampler3D noisevol;
uniform vec4 color;
uniform float tick;
int blursize = 2;
int blursize = 5;
vec2 texSize = vec2(32,32);
void main(void)
{
......@@ -25,13 +26,11 @@ void main(void)
}
}
// keycolor trick
float a = 1.0-center.a;
// float a = 1.0-center.r;
float delta = sample.a;
// float delta = max(max(sample.r,sample.g),sample.b)/factor;
float noise = texture3D(noiseVol, vec3(gl_TexCoord[0].xy,fTime0_1)).r;
float noise = texture3D(noisevol, vec3(gl_TexCoord[0].xy,fTime0_1)).r*2;
gl_FragColor = mix(center,delta*color*noise,a);
/*
......
......@@ -21,8 +21,9 @@ return {
frag = "unique_glow",
vert = nil,
args = {
color = color or {1,1,1,1},
texSize = size or {32, 32},
noisevol = { texture = 1 },
color = color or {1,0,1,1},
-- texSize = size or {32, 32},
},
clone = false,
}
......@@ -6,7 +6,7 @@ uniform vec4 color2;
void main(void)
{
float fTime0_X = tick / 10000;
float fTime0_X = tick / 100000;
vec2 coord = mapCoord+gl_TexCoord[0].xy;
float noisy = texture3D(noisevol,vec3(coord,fTime0_X)).r;
float noisy2 = texture3D(noisevol,vec3(coord/5.0,fTime0_X)).r;
......
......@@ -29,7 +29,11 @@ quickEntity('t', {show_tooltip=true, name='forest', display='#', color=colors.LI
quickEntity('l', {show_tooltip=true, name='Lorien', display='#', color=colors.GOLD, back_color=colors.DARK_GREEN, image="terrain/lorien.png", block_move=true})
quickEntity('v', {show_tooltip=true, name='old forest', display='#', color=colors.GREEN, back_color=colors.DARK_GREEN, image="terrain/tree_dark1.png", block_move=true})
quickEntity('i', {show_tooltip=true, name='iron mountains', display='^', color=colors.SLATE, back_color=colors.UMBER, image="terrain/mountain.png", block_move=true})
quickEntity('=', {show_tooltip=true, name='the great sea', display='~', color=colors.DARK_BLUE, back_color=colors.BLUE, image="terrain/river.png", block_move=true,})
quickEntity('=', {show_tooltip=true, name='the great sea', display='~', color=colors.DARK_BLUE, back_color=colors.BLUE, image="terrain/river.png", block_move=true,
shader = "water", textures = { function() local n = core.noise.new(3); return n:makeTexture3D(128, 128, 128, 0, 0, 0), true end },
})
quickEntity('.', {show_tooltip=true, name='plains', display='.', color=colors.LIGHT_GREEN, back_color=colors.DARK_GREEN, image="terrain/grass.png", can_encounter=true, equilibrium_level=-10})
quickEntity('g', {show_tooltip=true, name='Forodwaith, the cold lands', display='.', color=colors.LIGHT_BLUE, back_color=colors.BLUE, can_encounter=true, equilibrium_level=-10})
quickEntity('q', {show_tooltip=true, name='Icebay of Forochel', display=';', color=colors.LIGHT_BLUE, back_color=colors.BLUE, can_encounter=true, equilibrium_level=-10})
......
......@@ -30,6 +30,7 @@ newEntity{ define_as = "SHADE_OF_ANGMAR",
type = "undead", subtype = "skeleton", unique = true,
name = "The Shade of Angmar",
display = "s", color=colors.VIOLET,
shader = "unique_glow",
desc = [[This skeleton looks nasty. There is red flames in its empty eye sockets. It wield a nasty sword and towers toward you, throwing spells.]],
level_range = {7, 20}, exp_worth = 2,
max_life = 150, life_rating = 15, fixed_rating = true,
......
......@@ -220,8 +220,8 @@ static float noise3d(noise_t *n, float x, float y, float z)
float p[3];
p[0] = x;
p[1] = y;
p[2] = y;
return TCOD_noise_simplex(n->noise, p);
p[2] = z;
return (TCOD_noise_simplex(n->noise, p) + 1) / 2;
}
// Source: http://web.archive.org/web/20070706003038/http://www.cs.cmu.edu/~mzucker/code/perlin-noise-math-faq.html
......@@ -244,13 +244,12 @@ static float tilablenoise3d(noise_t *n, double ix, double iy, double iz, double
static int noise_texture3d(lua_State *L)
{
noise_t *n = (noise_t*)auxiliar_checkclass(L, "noise{core}", 1);
int w = luaL_checknumber(L, 3);
int h = luaL_checknumber(L, 4);
int d = luaL_checknumber(L, 5);
float zoom = luaL_checknumber(L, 6);
float x = luaL_checknumber(L, 7);
float y = luaL_checknumber(L, 8);
float z = luaL_checknumber(L, 9);
int w = luaL_checknumber(L, 2);
int h = luaL_checknumber(L, 3);
int d = luaL_checknumber(L, 4);
float x = luaL_checknumber(L, 5);
float y = luaL_checknumber(L, 6);
float z = luaL_checknumber(L, 7);
GLubyte *map = malloc(w * h * d * 3 * sizeof(GLubyte));
int i, j, k;
......@@ -260,7 +259,7 @@ static int noise_texture3d(lua_State *L)
{
for (k = 0; k < d; k++)
{
float v = tilablenoise3d(n, i+x, j+y, k+z, w, h, d);
float v = tilablenoise3d(n, i+x, j+y, k+z, w, h, d) * 255;
map[TEXEL3(i, j, k)] = (GLubyte)v;
map[TEXEL3(i, j, k)+1] = (GLubyte)v;
map[TEXEL3(i, j, k)+2] = (GLubyte)v;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment