singe/src/sceneShared.h
2026-09-07 01:28:53 -05:00

65 lines
2.8 KiB
C

/*
*
* Singe 3
* Copyright (C) 2006-2026 Scott Duensing <scott@kangaroopunch.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
*/
#ifndef SCENE_SHARED_H
#define SCENE_SHARED_H
// The limits and codes the scene's uniform blocks are laid out with, shared by the C side
// (scene.h, scene.c) and the shaders (shaders/scene.hlsl), so the two cannot drift apart.
// Preprocessor definitions only: this file is read by DXC as well as the C compiler.
// Sizes of the uniform arrays.
#define MAX_LIGHTS 8 // Lights the fragment shader sees per frame
#define MAX_JOINTS 128 // Joint matrices per skinned draw
#define MAX_SHADOWS MAX_LIGHTS // Every light may cast; the arrays are sized to the lights in use
#define MAX_MORPHS 8 // Active morph targets per draw
#define MAX_CASCADES 4 // Cascades of a directional light's shadow
#define SH_COEFFICIENTS 9 // Spherical harmonics to second order
// A shadow slot's kind (shadowInfo[slot].x).
#define SHADOW_NONE 0
#define SHADOW_MAP 1 // One map: a spot light, or a directional light without cascades
#define SHADOW_CUBE 2 // Six faces: a point light
#define SHADOW_CASCADE 3 // A directional light's shadow split along the camera's view
// A light's kind (positionType.w).
#define LIGHT_TYPE_DIRECTIONAL 0
#define LIGHT_TYPE_POINT 1
#define LIGHT_TYPE_SPOT 2
// The post pass's tone curve (postParams.y).
#define TONEMAP_CURVE_NONE 0
#define TONEMAP_CURVE_NEUTRAL 1
#define TONEMAP_CURVE_ACES 2
// What material.w says about the base texture.
#define TEXTURE_NONE 0
#define TEXTURE_SRGB 1 // A texture the sampler decodes to linear
#define TEXTURE_FEED 2 // A video frame or rendered view, sRGB, decoded in the shader
// How a draw turns to face the camera (the spare lane of its normal matrix, instanceMatrices).
#define BILLBOARD_MODE_NONE 0
#define BILLBOARD_MODE_ALL 1 // Its axes are the camera's
#define BILLBOARD_MODE_Y 2 // Turned about world +Y toward the eye only
#endif