objReader.getMeshNames(meshNames) for i in range(len(meshNames)): vertices = Vec3Array() normals = Vec3Array() uvs = Vec2Array() materialName = None materialName = objReader.getMeshData(meshNames[i], vertices, normals, uvs) if len(vertices) != 0: meshHandles[meshNames[i]] = constructMesh(meshNames[i], vertices, normals, uvs, materialName, bmh) lightManager = LightManager() sun = DirectionalLightSource( "Sun", vecmath.translation(Vec3(0.0, 7.5, -20.0)) * vecmath.directionalLightOrientation(vecmath.normalize(Vec3(-1.0, -1.0, -0.25))), ColorRGB(0.6, 0.6, 0.5)) sun.setCastShadows(True); sun.setShadowSamples(32); sun.setShadowAngle(0.025); lightManager.addLight(sun); sky = SkyLightSource( "Sky", vecmath.translation(Vec3(0.0, 5.0, -00.0)), ColorRGB(0.25, 0.3, 0.4)) lightManager.addLight(sky) sceneUpVector = ILB_UP_POS_Y sceneScale = 1.0 perspCamera = Camera("Camera", vecmath.translation(Vec3(-5.0, 5.0, -10.0)) * vecmath.cameraOrientation(vecmath.normalize(Vec3(0.25, -0.25, -1.0)), Vec3(0.0, 1.0, 0.0)), math.pi/2.0, 1.0) targetManager = TargetManager() objTrans = vecmath.scaleTranslation(Vec3(1.0, 1.0, 1.0), Vec3(0.0, 0.0, 0.0))
apiCall( ILBSetCastShadows(light, True) ) apiCall( ILBSetShadowSamples(light, 32) ) apiCall( ILBSetShadowAngle(light, 0.1) ) skylight = createNewLightHandle() primitives.apiCall( ILBCreateSkyLight( scene, 'SkyLight', vecmath.identity(), ColorRGB(0.21, 0.21, 0.3), skylight) ) # set up camera camPos = Vec3(10.0, 20.0, 10.0) lookAt = Vec3(0.0, -3.0, 0.0) camera = createNewCameraHandle() primitives.apiCall( ILBCreatePerspectiveCamera(scene, 'Camera', vecmath.setCameraMatrix(camPos, vecmath.normalize(lookAt - camPos), Vec3(0.0, 0.0, -1.0)), camera) ) apiCall( ILBSetFov(camera, M_PI/4.0, 1.0) ) # Create a textured diffuse material for sphere 0 sm0 = createNewMaterialHandle() tex = textures.createXorTexture( bmh, "Tex1", ColorRGB(0.6, 0.6, 0.3) ) apiCall( ILBCreateMaterial(scene, "Textured", sm0) ) apiCall( ILBSetMaterialTexture(sm0, ILB_CC_DIFFUSE, tex) ) apiCall( ILBSetMaterialOverrides(sphereInstances[0], sm0, 1) )