QMultiSampleAntiAliasing Class
class Qt3DRender::QMultiSampleAntiAliasing다중 샘플 앤티앨리어싱을 활성화합니다. 더 보기...
헤더: | #include <QMultiSampleAntiAliasing> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
qmake: | QT += 3drender |
QML에서: | MultiSampleAntiAliasing |
상속합니다: | Qt3DRender::QRenderState |
상태: | Deprecated |
공용 함수
QMultiSampleAntiAliasing(Qt3DCore::QNode *parent = nullptr) |
상세 설명
Qt3DRender::QMultiSampleAntiAliasing 클래스는 멀티샘플 안티앨리어싱을 활성화합니다.
QRenderPass::addRenderState()을 호출하여 QRenderPass 에 추가할 수 있습니다:
QRenderPass *renderPass = new QRenderPass(); QMultiSampleAntiAliasing *msaa = new QMultiSampleAntiAliasing(); renderPass->addRenderState(msaa);
또는 QRenderStateSet::addRenderState()을 호출하여 QRenderStateSet 에 추가할 수 있습니다:
QRenderStateSet *renderStateSet = new QRenderStateSet(); QMultiSampleAntiAliasing *msaa = new QMultiSampleAntiAliasing(); renderStateSet->addRenderState(msaa);
멀티샘플링이 적용되려면 렌더 타깃이 멀티샘플링이 활성화된 상태로 할당되어 있어야 합니다:
QTexture2DMultisample *colorTex = new QTexture2DMultisample; colorTex->setFormat(QAbstractTexture::RGBA8_UNorm); colorTex->setWidth(1024); colorTex->setHeight(1024); QRenderTargetOutput *color = new QRenderTargetOutput; color->setAttachmentPoint(QRenderTargetOutput::Color0); color->setTexture(colorTex); QTexture2DMultisample *depthStencilTex = new QTexture2DMultisample; depthStencilTex->setFormat(QAbstractTexture::RGBA8_UNorm); depthStencilTex->setWidth(1024); depthStencilTex->setHeight(1024); QRenderTargetOutput *depthStencil = new QRenderTargetOutput; depthStencil->setAttachmentPoint(QRenderTargetOutput::DepthStencil); depthStencil->setTexture(depthStencilTex); Qt3DRender::QRenderTarget *renderTarget = new Qt3DRender::QRenderTarget; renderTarget->addOutput(color); renderTarget->addOutput(depthStencil);
또한 셰이더 코드에서 멀티샘플링 샘플러 유형과 texture() 대신 texelFetch()를 사용해야 합니다.
예를 들어 다음과 같은 코드가 있는 경우
#version 150 uniform sampler2D colorTexture; in vec2 texCoord; out vec4 fragColor; void main() { fragColor = texture(colorTexture, texCoord); }
와 같은 코드가 있다면 다음과 같이 다시 작성할 수 있습니다.
#version 150 uniform sampler2DMS colorTexture; in vec2 texCoord; out vec4 fragColor; void main() { ivec2 tc = ivec2(floor(textureSize(colorTexture) * texCoord)); vec4 c = texelFetch(colorTexture, tc, 0) + texelFetch(colorTexture, tc, 1) + texelFetch(colorTexture, tc, 2) + texelFetch(colorTexture, tc, 3); fragColor = c / 4.0; }
참고: 그래픽 API로 OpenGL을 사용하는 경우, 렌더링 상태에 QMultiSampleAntiAliasing이 추가된 경우 glEnable(GL_MULTISAMPLE)이 호출됩니다.
멤버 함수 문서
[explicit]
QMultiSampleAntiAliasing::QMultiSampleAntiAliasing(Qt3DCore::QNode *parent = nullptr)
생성자는 지정된 parent 을 사용하여 새 QMultiSampleAntiAliasing::QMultiSampleAntiAliasing 인스턴스를 생성합니다.
© 2025 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.