VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
stencilParameters.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2025-2026 Arnis Lektauers
3//
4// Created by Arnis Lektauers on 09.11.2025.
5//
6#include <sstream>
7
8#include "stencilParameters.h"
9
10namespace visutwin::canvas
11{
12 StringIds StencilParameters::stringIds;
13
15 {
16 if (_dirty) {
17 evalKey();
18 }
19 return _key;
20 }
21
22 void StencilParameters::evalKey()
23 {
24 // Create a string key from all parameters
25 std::ostringstream oss;
26 oss << _func << "," << _ref << "," << _fail << "," << _zfail << "," << _zpass << "," << _readMask << "," << _writeMask;
27 std::string key = oss.str();
28
29 // Convert a string to a unique number
30 _key = stringIds.get(key);
31 _dirty = false;
32 }
33}
int get(const std::string &name)
Definition stringIds.cpp:10