-
Notifications
You must be signed in to change notification settings - Fork 7
/
GenericModelDawn.h
80 lines (62 loc) · 1.9 KB
/
GenericModelDawn.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// Copyright (c) 2019 The Aquarium Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// GenericModelDawn.h: Defnes generic model of Dawn
#pragma once
#ifndef GENERICMODELDAWN_H
#define GENERICMODELDAWN_H 1
#include "ContextDawn.h"
#include "ProgramDawn.h"
#include "dawn/webgpu_cpp.h"
#include "utils/ComboRenderPipelineDescriptor.h"
#include "../Model.h"
class GenericModelDawn : public Model
{
public:
GenericModelDawn(Context *context,
Aquarium *aquarium,
MODELGROUP type,
MODELNAME name,
bool blend);
~GenericModelDawn();
void init() override;
void prepareForDraw() override;
void draw() override;
void updatePerInstanceUniforms(const WorldUniforms &worldUniforms) override;
TextureDawn *mDiffuseTexture;
TextureDawn *mNormalTexture;
TextureDawn *mReflectionTexture;
TextureDawn *mSkyboxTexture;
BufferDawn *mPositionBuffer;
BufferDawn *mNormalBuffer;
BufferDawn *mTexCoordBuffer;
BufferDawn *mTangentBuffer;
BufferDawn *mBiNormalBuffer;
BufferDawn *mIndicesBuffer;
struct LightFactorUniforms
{
float shininess;
float specularFactor;
} mLightFactorUniforms;
struct WorldUniformPer
{
WorldUniforms WorldUniforms[20];
};
WorldUniformPer mWorldUniformPer;
private:
utils::ComboVertexStateDescriptor mVertexStateDescriptor;
wgpu::RenderPipeline mPipeline;
wgpu::BindGroupLayout mGroupLayoutModel;
wgpu::BindGroupLayout mGroupLayoutPer;
wgpu::PipelineLayout mPipelineLayout;
wgpu::BindGroup mBindGroupModel;
wgpu::BindGroup mBindGroupPer;
wgpu::Buffer mLightFactorBuffer;
wgpu::Buffer mWorldBuffer;
ContextDawn *mContextDawn;
ProgramDawn *mProgramDawn;
int instance;
};
#endif