Esempio n. 1
0
def getCubeData(scale=(2, 2, 2), st=False, rgb=np.array([0.0, 0.0, 0.0])):
    dataCube, facesCube = create_cube(scale=(2, 2, 2),
                                      st=False,
                                      rgba=np.array(
                                          [rgb[0], rgb[1], rgb[2], 1.0]),
                                      dtype='float32',
                                      type='triangles')
    verticesCube = ch.Ch(dataCube[:, 0:3])
    UVsCube = ch.Ch(np.zeros([verticesCube.shape[0], 2]))

    facesCube = facesCube.reshape([-1, 3])
    import shape_model
    normalsCube = -shape_model.chGetNormals(verticesCube, facesCube)
    haveTexturesCube = [[False]]
    texturesListCube = [[None]]
    vColorsCube = ch.Ch(dataCube[:, 3:6])

    return verticesCube, facesCube, normalsCube, vColorsCube, texturesListCube, haveTexturesCube
Esempio n. 2
0
chVertices = ch.dot(geometry.RotateZ(-np.pi / 2)[0:3, 0:3], chVertices.T).T

smFaces = [[faces]]
smVColors = [chVColorsGT * np.ones(chVertices.shape)]
smUVs = ch.Ch(np.zeros([chVertices.shape[0], 2]))
smHaveTextures = [[False]]
smTexturesList = [[None]]

chVertices = chVertices - ch.mean(chVertices, axis=0)

chVertices = chVertices * 0.09
smCenter = ch.array([0, 0, 0.1])

smVertices = [chVertices]
chNormals = shape_model.chGetNormals(chVertices, faces)
smNormals = [chNormals]

center = smCenter
UVs = smUVs
v = smVertices
vn = smNormals
Faces = smFaces
VColors = smVColors
HaveTextures = smHaveTextures
TexturesList = smTexturesList

v_transf, vn_transf = transformObject(v, vn, chScaleGT, chAzimuthGT,
                                      chPositionGT)

vc_illuminated = computeGlobalAndDirectionalLighting(vn_transf, VColors,