本页内容

Layer QML Type

图层提供了一种过滤要渲染的实体的机制。更多内容...

Import Statement: import Qt3D.Render 2.12
In C++: QLayer
Inherits:

Component3D

Status: Deprecated

此类型已弃用。我们强烈建议不要在新代码中使用它。

属性

详细说明

图层与FrameGraph中的LayerFilter 协同工作。

通过将递归属性设置为 true,可以将图层应用到实体的子树上。

import Qt3D.Core 2.0
import Qt3D.Render 2.0

Entity {
    id: root

    components: RenderSettings {
        // FrameGraph
        Viewport {
            ClearBuffers {
                buffers: ClearBuffers.ColorDepthBuffer
                CameraSelector {
                    camera: mainCamera
                    LayerFilter {
                        layers: [layer1]
                    }
                }
            }
        }
    }

    // Scene
    Camera { id: mainCamera }

    Layer {
        id: layer1
        recursive: true
    }

    GeometryRenderer { id: mesh }

    Entity {
        id: renderableEntity
        components: [ mesh, layer1 ]
    }
}

另请参阅 LayerFilter 。

属性文档

recursive : bool

指定该图层是否也应用于实体子树。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.