Esempio n. 1
0
"""
shader effect sample
"""

import igeCore as core
from igeCore.apputil import graphicsHelper
import igeVmath as vmath

from igeCore import devtool
devtool.convertAssets('.', '.', core.TARGET_PLATFORM_ANDROID, 0.1)

core.window(True, 480, 640)

shader = core.shaderGenerator()
shader.setColorTexture(True)  #use color texture
shader.setDistortion(True)  #add distortion effect
shader.setUVScroll(1, True)  #start uv scroll at uv channel 1
shader.setNormalTextureUVSet(1, 1)  #change normal texture uv channel to 1
shader.setProjectionMapping(1, True)  #projection mapping mode at uv channel 1

print(shader)  #print shader program

shadowSprite = graphicsHelper.createSprite(200, 200, "fire", shader=shader)

#set uv scroll speed for uv set 1
shadowSprite.setMaterialParam("mate", "ScrollSpeedSet1", (0.0, -0.08))

#set distortion strength
shadowSprite.setMaterialParam("mate", "DistortionStrength", (0.02, ))

#set normal texture for distortion
Esempio n. 2
0
"""

Shadow mapping sample

"""

import igeCore as core
from igeCore.apputil import graphicsHelper
import igeVmath as vmath

#asset convert
from igeCore import devtool
devtool.convertAssets('.', '.', core.TARGET_PLATFORM_MOBILE, 0.1)

core.window(True, 640, 480)

core.shaderGenerator().globalShadowBias = 0.001

#ground plane
ground = core.figure('ground')
for i in range(ground.numMaterials):
    shaderGen = ground.getShaderGenerator(i)  #get current shader
    shaderGen.setShadow(
        False, True, True
    )  #add shadow function(no make shadow, receive shadow, depth shadow)
    ground.setShaderGenerator(i, shaderGen)  #set new shader

#scene object
box = core.figure('box')
for i in range(box.numMaterials):
    shaderGen = box.getShaderGenerator(i)  #get current shader
Esempio n. 3
0
"""
"""

import igeCore as core
import igeVmath as vmath
import shapes
import sys
import math

from igeCore import devtool
devtool.convertAssets('.', '.', core.TARGET_PLATFORM_PC)

core.window(True, 480, 640)


def IntersectRayAABB(p, d, min, max):
    tmin = 0.0
    tmax = sys.float_info.max
    for i in range(3):
        if math.fabs(d.getElem(i)) < sys.float_info.epsilon:
            if p.getElem(i) < min.getElem(i) or p.getElem(i) > max.getElem(i):
                return False, 0, vmath.vec3()
        else:
            ood = 1.0 / d.getElem(i)
            t1 = (min.getElem(i) - p.getElem(i)) * ood
            t2 = (max.getElem(i) - p.getElem(i)) * ood
            if t1 > t2: t1, t2 = t2, t1
            if t1 > tmin: tmin = t1
            if t2 < tmax: tmax = t2
            if tmin > tmax: return False, 0, vmath.vec3()
    q = p + d * tmin
Esempio n. 4
0
import igeCore
from igeCore import devtool
import os

# devtool.convertAssets('.','.', igeCore.TARGET_PLATFORM_PC)
devtool.convertAssets('.', '.', igeCore.TARGET_PLATFORM_MOBILE)

for root, dirs, files in os.walk("Effects"):
    for file in files:
        if file.endswith(".efkproj") or file.endswith(".efkefc"):
            file_input = os.path.join(root, file)
            file_output = os.path.splitext(file_input)[0] + ".efk"
            command = "Tool\Effekseer.exe -cui -in " + str(
                file_input) + " -e " + str(file_output)
            print('processing ' + file_input)
            os.system(command)