Exemplo n.º 1
0
 def __init__( self):
     self.currentState = STATUS_STAY
     self.nextState = STATUS_STAY
     self.figure = core.figure('Sapphiart/Sapphiart')
     self.figure.connectAnimator(core.ANIMETION_SLOT_A0, STATE_MOTION[self.currentState])
     self.currentDir= vmath.vec3(0,0,1)
     self.gorlDir= vmath.vec3(0,0,1)
     self.currentPosition = vmath.vec3(0,0,0)
     self.transitTime = 0.0
Exemplo n.º 2
0
    def __init__(self, world):
        self.figure = core.figure('capeMan')

        points = self.figure.getVertexElements('body',
                                               core.ATTRIBUTE_ID_POSITION,
                                               core.WorldSpace)
        shape = igeBullet.shape(igeBullet.CONVEX_HULL_SHAPE_PROXYTYPE,
                                points=points)
        min, max = shape.getAabb()
        compound = igeBullet.shape(igeBullet.COMPOUND_SHAPE_PROXYTYPE)
        compound.addChildShape(shape, (0, -min[1], 0), (0, 0, 0, 1))
        self.body = igeBullet.rigidBody(compound, 5, (0, 0, 0), (0, 0, 0, 1))
        self.body.angularFactor = (0, 1, 0)
        world.add(self.body)
        #utl = Utils()
        #utl.AddShapeMesh(compound)

        points = self.figure.getVertexElements('cape',
                                               core.ATTRIBUTE_ID_POSITION,
                                               space=core.WorldSpace)
        triangles = self.figure.getTriangles('cape')
        self.soft = igeBullet.softBody(world, points, triangles)
        self.figure.killJointTransform('cape')
        self.figure.setMaterialRenderState('phong1', 'cull_face_enable', False)
        pos, _, _ = self.figure.getJoint('anchor1', core.WorldSpace)
        no, pos = self.soft.findNearestNode(pos)
        self.soft.appendDeformableAnchor(no, self.body)
        pos, _, _ = self.figure.getJoint('anchor2', core.WorldSpace)
        no, pos = self.soft.findNearestNode(pos)
        self.soft.appendDeformableAnchor(no, self.body)
        pos, _, _ = self.figure.getJoint('anchor3', core.WorldSpace)
        no, pos = self.soft.findNearestNode(pos)
        self.soft.appendDeformableAnchor(no, self.body)
        pos, _, _ = self.figure.getJoint('anchor4', core.WorldSpace)
        no, pos = self.soft.findNearestNode(pos)
        self.soft.appendDeformableAnchor(no, self.body)
Exemplo n.º 3
0
fig.saveFigure("human/female01")

#convert figure 02
fig.clear()
tools.loadModel("human/female02.fbx", fig, convertOption)
tools.findConvertReplaceTextures(fig, ".", ".", core.TARGET_PLATFORM_MOBILE)
fig.saveFigure("human/female02")

#convert animation
fig.clear()
tools.loadModel("human/F_clap.FBX", fig, convertOption)
fig.saveAnimation("human/F_clap")

showcase = core.showcase("case")

fig1 = core.figure("human/female01")
fig2 = core.figure("human/female02")
anm = core.animator("human/F_clap")
fig1.connectAnimator(core.ANIMETION_SLOT_A0, anm)
fig2.connectAnimator(core.ANIMETION_SLOT_A0, anm)

fig1.position = (-50, 0, 0)
fig2.position = (50, 0, 0)

showcase.add(fig1, 1.0)
showcase.add(fig2, 1.0)

rotX = 0
rotY = 0
while True:
    core.update()
Exemplo n.º 4
0
"""

import igeCore as core
from igeCore import devtool
from igeCore import apputil
from igeCore.apputil import graphicsHelper

import igeVmath as vmath
import os

devtool.convertAssets('.', '.', core.TARGET_PLATFORM_PC,0.1)

core.window(True, 480, 640)

figure = core.figure('sample')

arrow = core.figure('arrow')
arrow.position = (0,0.5,0)

cam = core.camera()
cam.position = (0,1,2)
cam.target = (0,0,0)

env = core.environment()
env.setDirectionalLampColor(0, (0.9, 0.8, 1.0))

showcase = core.showcase("case")
showcase.add(env)
showcase.add(figure)
showcase.add(arrow)
Exemplo n.º 5
0
_scale = 1.0, 1.0, 1.0
_dynamic = 100.0, 0.0, 0.0, 0.0
_particle.framerate = 60.0
_show_enabled = True
_loop_enabled = True
_handle = _particle.add(effect_list[effect_current], loop=_loop_enabled)
_particle.set_location(_handle, _position[0], _position[1], _position[2])
_particle.set_scale(_handle, _scale[0], _scale[1], _scale[2])

showcase = core.showcase("showcase")
camera = core.camera("cam01")
# camera.orthographicProjection = True
# camera.orthoHeight = _h / 50
camera.position = (10, 5, 10)

figure = core.figure('Sapphiart/Sapphiart')
figure.position = _position
showcase.add(figure)

while True:
    w, h = core.viewSize()
    curX = 0
    curY = 0
    press = 0
    touch = core.singleTouch()
    if touch != None:
        curX = touch['cur_x'] + w // 2
        curY = -touch['cur_y'] + h // 2
        press = touch['is_holded'] | touch['is_moved']
    impl.process_inputs()
Exemplo n.º 6
0

def createEditableFigure():
    shader = core.shaderGenerator()
    shader.setBoneCondition(1, 1)
    shader.setAmbientType(core.AMBIENT_TYPE_AMBIENT)
    shader.setNumDirLamp(1)
    efig = core.editableFigure('figure')
    efig.addMaterial("mate", shader)
    efig.addMesh("mesh", "mate")
    efig.addJoint("joint")
    efig.setMaterialParam("mate", "DiffuseColor", (1.0, 1.0, 1.0, 1.0))
    return efig


figure2 = core.figure('bone')
figure2.position = (0, 0, 0)

aabbBox2 = createEditableFigure()
min, max = figure2.getAABB(-1, core.WorldSpace)
poss, noms, uvs, idxs = shapes.makeBoxFromAABB(min, max)
aabbBox2.setVertexElements("mesh", core.ATTRIBUTE_ID_POSITION, poss)
aabbBox2.setVertexElements("mesh", core.ATTRIBUTE_ID_NORMAL, noms)
aabbBox2.setVertexElements("mesh", core.ATTRIBUTE_ID_UV0, uvs)
aabbBox2.setTriangles("mesh", idxs)
aabbBox2.setMeshPrimitiveType(0, core.GL_LINE_STRIP)

cam = core.camera()
#cam.orthographicProjection = True
#cam.widthBase = True
#cam.orthoWidth = 1.0
Exemplo n.º 7
0
"""

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
    shaderGen.setShadow(
        True, True,
        True)  #add shadow function(make shadow, receive shadow, depth shadow)
    box.setShaderGenerator(i, shaderGen)  #set new shader
Exemplo n.º 8
0
"""
"""

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, 800, 320)

#core.autoSaveShader("shaders")
#core.autoReadShader("shaders")

box = core.figure('char0/char0')
box.setMaterialParam(0, "ScrollSpeedSet1", (0.0, -0.08))
box.setMaterialParam(0, "DistortionStrength", (0.02, ))
box.setMaterialParamTexture(0,
                            "NormalSampler",
                            "char0/NormalMap",
                            wrap_s=core.SAMPLERSTATE_WRAP,
                            wrap_t=core.SAMPLERSTATE_WRAP,
                            minfilter=core.SAMPLERSTATE_LINEAR,
                            magfilter=core.SAMPLERSTATE_LINEAR)

ground = core.figure('ground/ground')

cam = core.camera()
cam.position = (-100, 100, 100)
cam.target = (0, 0, 0)
Exemplo n.º 9
0
world = igeBullet.world(True)

efig = utl.GetFigure()
efig.clearMesh()
shape = igeBullet.shape(igeBullet.BOX_SHAPE_PROXYTYPE, halfExtents=(15, 2, 15))
body1 = igeBullet.rigidBody(shape, 0, (0, 0, 0), (0, 0, 0, 1))
world.add(body1)
utl.AddShapeMesh(shape)

shape = igeBullet.shape(igeBullet.BOX_SHAPE_PROXYTYPE, halfExtents=(3, 3, 3))
body2 = igeBullet.rigidBody(shape, 5, (5, 8, 0), (0, 0, 0, 1))
world.add(body2)
utl.AddShapeMesh(shape)

sphere = core.figure('box')
poss = sphere.getVertexElements(0, core.ATTRIBUTE_ID_POSITION)
tris = sphere.getTriangles(0)
soft = igeBullet.softBody(world, poss, tris, mass=5.5, springStiffness=50.0)
soft.transform = ((0, 30, 0), (0, 0, 0, 1))

print(soft.transform)
#soft.collisionGroupBit = 0
#soft.collisionGroupMask = 0

cam = core.camera()
cam.position = (0, 50, 50)
cam.target = (0, 0, 0)

showcase = core.showcase("case")
showcase.add(efig)