<commit_before>#ifndef SOFTWARE_RENDERER_H
#define SOFTWARE_RENDERER_H

#include <array>
#include <atomic>
#include <condition_variable>
#include <cstdint>
#include <mutex>
#include <thread>
#include <unordered_map>
#include <vector>

#include "RendererSystem3D.h"
#include "../Entities/EntityManager.h"
#include "../Game/Options.h"
#include "../Math/MathUtils.h"
#include "../Math/Matrix4.h"
#include "../Math/Vector2.h"
#include "../Math/Vector3.h"
#include "../Math/Vector4.h"
#include "../Media/Palette.h"
#include "../World/DistantSky.h"
#include "../World/LevelData.h"
#include "../World/VoxelDefinition.h"
#include "../World/VoxelUtils.h"

#include "components/utilities/Buffer2D.h"
#include "components/utilities/BufferView.h"
#include "components/utilities/BufferView2D.h"

// CPU-based 2.5D rendering.

class Entity;
class VoxelGrid;

enum class VoxelFacing2D;

class SoftwareRenderer : public RendererSystem3D
{
private:
	struct VoxelTexel
	{
		double r, g, b, emission;
		bool transparent; // Only supports alpha testing, not alpha blending.

		void init(double r, double g, double b, double emission, bool transparent);
	};

	// @todo: to finish the citizen variation rework, this needs to be 8-bit.
	// - for each entity instance in the renderer, check if it has a custom palette mapping. If so, use that
	//   in the entity shader instead of the base palette.
	// - thinking of a std::vector<std::pair<EntityID, const Palette*>> passed to the renderer every frame.
	struct FlatTexel
	{
		uint8_t value;

		void init(uint8_t value);
	};

	// For distant sky objects (mountains, clouds, etc.). Although most distant objects
	// only need alpha-testing, some clouds have special case texels for a simple form<commit_msg>Removed citizen variations comment.<commit_after>#ifndef SOFTWARE_RENDERER_H
#define SOFTWARE_RENDERER_H

#include <array>
#include <atomic>
#include <condition_variable>
#include <cstdint>
#include <mutex>
#include <thread>
#include <unordered_map>
#include <vector>

#include "RendererSystem3D.h"
#include "../Entities/EntityManager.h"
#include "../Game/Options.h"
#include "../Math/MathUtils.h"
#include "../Math/Matrix4.h"
#include "../Math/Vector2.h"
#include "../Math/Vector3.h"
#include "../Math/Vector4.h"
#include "../Media/Palette.h"
#include "../World/DistantSky.h"
#include "../World/LevelData.h"
#include "../World/VoxelDefinition.h"
#include "../World/VoxelUtils.h"

#include "components/utilities/Buffer2D.h"
#include "components/utilities/BufferView.h"
#include "components/utilities/BufferView2D.h"

// CPU-based 2.5D rendering.

class Entity;
class VoxelGrid;

enum class VoxelFacing2D;

class SoftwareRenderer : public RendererSystem3D
{
private:
	struct VoxelTexel
	{
		double r, g, b, emission;
		bool transparent; // Only supports alpha testing, not alpha blending.

		void init(double r, double g, double b, double emission, bool transparent);
	};

	struct FlatTexel
	{
		uint8_t value;

		void init(uint8_t value);
	};

	// For distant sky objects (mountains, clouds, etc.). Although most distant objects
	// only need alpha-testing, some clouds have special case texels for a simple form
{'fraction_non_alphanumeric': 0.13454198473282442, 'fraction_numerical': 0.008587786259541985, 'mean_word_length': 4.422413793103448, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7239986', 'n_tokens_mistral': 1054, 'n_tokens_neox': 1025, 'n_words': 304}