The aim is to create a familiar and flexible scene graph capable of building complex dynamic scenes for games and beyond.
std::shared_ptr<impeller::Context> context =
;
auto allocator = context->GetResourceAllocator();
auto dash_gltf = impeller::scene::LoadGLTF(allocator, "models/dash.glb");
auto environment_hdri =
impeller::scene::LoadHDRI(allocator, "environment/table_mountain.hdr");
scene.Add(dash_gltf.scene);
auto& dash_player = dash_gltf.scene.CreateAnimationPlayer();
auto& walk_action = dash_player.CreateClipAction(dash_gltf.GetClip("Walk"));
walk_action.SetLoop(impeller::scene::AnimationAction::kLoopForever);
walk_action.SetWeight(0.7f);
walk_action.Seek(0.0f);
walk_action.Play();
auto& run_action = dash_player.CreateClipAction(dash_gltf.GetClip("Run"));
run_action.SetLoop(impeller::scene::AnimationAction::kLoopForever);
run_action.SetWeight(0.3f);
run_action.Play();
scene.GetRoot().AddChild(
impeller::scene::DirectionalLight(
5,
{2, 3, 4}));
Mesh sphere_mesh;
sphere_node.SetGlobalTransform(
auto sphere_geometry =
impeller::scene::Geometry::MakeSphere(allocator, 2);
auto material = impeller::scene::Material::MakeStandard();
material->SetRoughness(0.4);
material->SetMetallic(0.2);
material->SetEnvironmentMap(environment_hdri);
material->SetFlatShaded(true);
material->SetBlendConfig({
});
material->SetStencilConfig({
});
sphere_mesh.AddPrimitive({sphere_geometry, material});
sphere_node.SetMesh(sphere_mesh);
cube_node.SetLocalTransform(Matrix::MakeTranslation({4, 0, 0}));
Mesh cube_mesh;
allocator, {4, 4, 4});
cube_mesh.AddPrimitive({cube_geometry, material});
cube_node.SetMesh(cube_mesh);
sphere_node.AddChild(cube_node);
scene.GetRoot().AddChild(sphere_node);
auto dof = impeller::scene::PostProcessingEffect::MakeBokeh(
0.2,
50);
scene.SetPostProcessing({dof});
while(true) {
std::unique_ptr<impeller::Surface>
surface = ;
auto camera =
impeller::Camera::MakePerspective(
{50, -30, 50})
.LookAt(
impeller::Vector3::Zero,
{0, -1, 0});
scene.Render(render_target, camera);
auto size = render_target.GetRenderTargetSize();
auto minimap_camera =
impeller::Camera::MakeOrthographic(
Rect::MakeLTRB(-100, -100, 100, 100),
{0, -50, 0})
.LookAt(
impeller::Vector3::Zero,
{0, 0, 1})
.WithViewport(IRect::MakeXYWH(
size.width / 4,
size.height / 4,
scene.Render(render_target, minimap_camera);
return true;
});
}
static std::shared_ptr< CuboidGeometry > MakeCuboid(Vector3 size)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
@ kAlways
Comparison test passes always passes.
@ kIncrementClamp
Increment the current stencil value by 1. Clamp it to the maximum.
static constexpr Color Red()
static constexpr Color AntiqueWhite()