/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #pragma once #include #include #include #include #include namespace AtomSampleViewer { /* * Testing different Stencil Comparison Function * First render all color triangles with stencil set to 1 * Then render white triangles with different functions * From top left to bottom right : * Never, Less, Equal, LessEqual, Greater, NotEqual, GreaterEqual, Always */ class StencilExampleComponent final : public BasicRHIComponent { public: AZ_COMPONENT(StencilExampleComponent, "{30979B47-9B6C-49D5-BA4D-A88452247D9F}", AZ::Component); AZ_DISABLE_COPY(StencilExampleComponent); static void Reflect(AZ::ReflectContext* context); StencilExampleComponent(); ~StencilExampleComponent() override = default; protected: // AZ::Component void Activate() override; void Deactivate() override; // Triangles setting void SetTriangleVertices(int startIndex, VertexPosition* vertexData, AZ::Vector3 center, float offset); AZ::RHI::Ptr m_inputAssemblyBufferPool; AZ::RHI::Ptr m_inputAssemblyBuffer; AZ::RHI::ConstPtr m_pipelineStateBasePass; AZStd::array, 8> m_pipelineStateStencil; static const size_t s_numberOfVertices = 48; struct BufferData { AZStd::array m_positions; AZStd::array m_colors; AZStd::array m_indices; }; AZ::RHI::GeometryView m_geometryView; AZ::RHI::GeometryView m_geometryView2; AZ::RHI::AttachmentId m_depthStencilID; AZ::RHI::ClearValue m_depthClearValue; }; }