universo-platform-3d
144 строки · 2.7 Кб
1import { ApiProperty } from '@nestjs/swagger'
2import mongoose, { Document } from 'mongoose'
3import { Light } from '../godot-types/light.schema'
4import { Clouds, CloudsSchema } from '../godot-types/clouds.schema'
5import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
6import { Vector3AsArray } from '../option-sets/vectors'
7
8export type EnvironmentDocument = Environment & Document
9
10@Schema({
11timestamps: true,
12toJSON: {
13virtuals: true
14}
15})
16export class Environment {
17@ApiProperty()
18_id: string
19
20@Prop({
21required: true,
22default: [0.05882353, 0.05882353, 0.05882353],
23type: mongoose.Types.Array
24})
25@ApiProperty()
26skyTopColor: Vector3AsArray
27
28@Prop({
29required: true,
30default: [0.1372549, 0.1372549, 0.1372549],
31type: mongoose.Types.Array
32})
33@ApiProperty()
34skyHorizonColor: Vector3AsArray
35
36@Prop({
37required: true,
38default: [0.18431373, 0.18431373, 0.16862745],
39type: mongoose.Types.Array
40})
41@ApiProperty()
42skyBottomColor: Vector3AsArray
43
44@Prop({
45required: true,
46default: 1
47})
48@ApiProperty()
49sunCount: number
50
51@Prop()
52@ApiProperty()
53suns: Light[]
54
55@Prop({
56required: true,
57default: false
58})
59@ApiProperty()
60fogEnabled: boolean
61
62@Prop({
63default: true
64})
65@ApiProperty()
66fogVolumetric: boolean
67
68@Prop({
69default: 0.01
70})
71@ApiProperty()
72fogDensity: number
73
74@Prop({
75default: [0.8, 0.9, 1.0],
76type: mongoose.Types.Array
77})
78@ApiProperty()
79fogColor: Vector3AsArray
80
81@Prop({
82required: true,
83default: true
84})
85@ApiProperty()
86ssao: boolean
87
88@Prop({
89required: true,
90default: true
91})
92@ApiProperty()
93glow: boolean
94
95@Prop({
96required: true,
97default: 1.0
98})
99@ApiProperty()
100glowHdrThreshold: number
101
102@Prop({
103required: true,
104default: 'medium'
105})
106@ApiProperty()
107shadowsPreset: string
108
109@Prop({
110required: true,
111default: false
112})
113@ApiProperty()
114globalIllumination: boolean
115
116@Prop({
117required: true,
118default: 'physical_sky'
119})
120@ApiProperty()
121environment: string
122
123@Prop({
124required: true,
125default: 2
126})
127@ApiProperty()
128tonemap: number
129
130@Prop({ type: CloudsSchema, required: false })
131@ApiProperty({ type: () => Clouds })
132clouds: Clouds
133
134@Prop({ type: Boolean, required: false, default: false })
135@ApiProperty({ type: () => Boolean, required: false, default: false })
136ssr?: boolean
137
138@ApiProperty()
139createdAt: Date // this is managed by mongoose timestamps: true, but defining it here so types will align
140@ApiProperty()
141updatedAt: Date // this is managed by mongoose timestamps: true, but defining it here so types will align
142}
143
144export const EnvironmentSchema = SchemaFactory.createForClass(Environment)
145