C+WINAPIと3DCGの理屈その6
影(シャドウ)を加えて見ました。#include"DXLib.h"#include<math.h>#include<stdlib.h>#include<windows.h>#define CELL 1.0fconst float FOV_F = 600.0f;const int HEIGHT = 240;const int WIDTH = 320;struct VTX { float x, y, z; float u, v; float b; // 旧Gouraud用(頂点の明るさ)。互換のため残しているが新パイプラインでは未使用};struct Camera{ float x, y, z; float yaw; // 左右回転のみ float height;};enum WallDir{ WALL_NORTH, WALL_SOUTH, WALL_WEST, WALL_EAST};struct Vec3{ float x; float y; float z;};float ZBuf[HEIGHT][WIDTH];#define RAD (3.14159265/180.0)Camera cam;// ==================================================// ライティング関連// ・平行光源+環境光で「面の向き」による明るさのベースを作る// ・さらにプレイヤー位置を松明(点光源)とみなし、距離減衰を加算する// ・フォン
0