Changeset View
Changeset View
Standalone View
Standalone View
source/renderer/ModelVertexRenderer.h
/* Copyright (C) 2012 Wildfire Games. | /* Copyright (C) 2021 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | public: | ||||
* ModelRenderer implementations must call this function before any | * ModelRenderer implementations must call this function before any | ||||
* calls to other rendering related functions. | * calls to other rendering related functions. | ||||
* | * | ||||
* Recursive calls to BeginPass are not allowed, and every BeginPass | * Recursive calls to BeginPass are not allowed, and every BeginPass | ||||
* is matched by a corresponding call to EndPass. | * is matched by a corresponding call to EndPass. | ||||
* | * | ||||
* @param streamflags Vertex streams required by the fragment stage. | * @param streamflags Vertex streams required by the fragment stage. | ||||
*/ | */ | ||||
virtual void BeginPass(int streamflags) = 0; | virtual void BeginPass(const CShaderProgramPtr& shader, int streamflags) = 0; | ||||
/** | /** | ||||
* EndPass: Cleanup OpenGL state set up by BeginPass. | * EndPass: Cleanup OpenGL state set up by BeginPass. | ||||
* | * | ||||
* ModelRenderer implementations must call this function after | * ModelRenderer implementations must call this function after | ||||
* rendering related functions for one pass have been called. | * rendering related functions for one pass have been called. | ||||
* | * | ||||
Show All 15 Lines | public: | ||||
* | * | ||||
* @param streamflags Vertex streams required by the fragment stage. | * @param streamflags Vertex streams required by the fragment stage. | ||||
* This equals the streamflags parameter passed on the last call to | * This equals the streamflags parameter passed on the last call to | ||||
* BeginPass. | * BeginPass. | ||||
* @param def The model definition. | * @param def The model definition. | ||||
*/ | */ | ||||
virtual void PrepareModelDef(const CShaderProgramPtr& shader, int streamflags, const CModelDef& def) = 0; | virtual void PrepareModelDef(const CShaderProgramPtr& shader, int streamflags, const CModelDef& def) = 0; | ||||
virtual bool CanInstance() const = 0; | |||||
/** | /** | ||||
* RenderModel: Invoke the rendering commands for the given model. | * RenderModel: Invoke the rendering commands for the given model. | ||||
* | * | ||||
* ModelRenderer implementations must call this function to perform | * ModelRenderer implementations must call this function to perform | ||||
* the actual rendering. | * the actual rendering. | ||||
* | * | ||||
* preconditions : The most recent call to PrepareModelDef since | * preconditions : The most recent call to PrepareModelDef since | ||||
* BeginPass has been for model->GetModelDef(). | * BeginPass has been for model->GetModelDef(). | ||||
* | * | ||||
* @param streamflags Vertex streams required by the fragment stage. | * @param streamflags Vertex streams required by the fragment stage. | ||||
* This equals the streamflags parameter passed on the last call to | * This equals the streamflags parameter passed on the last call to | ||||
* BeginPass. | * BeginPass. | ||||
* @param model The model that should be rendered. | * @param model The model that should be rendered. | ||||
* @param data Private data for the model as returned by CreateModelData. | * @param data Private data for the model as returned by CreateModelData. | ||||
* | * | ||||
* postconditions : Subsequent calls to RenderModel for models | * postconditions : Subsequent calls to RenderModel for models | ||||
* that use the same CModelDef object and the same texture must | * that use the same CModelDef object and the same texture must | ||||
* succeed. | * succeed. | ||||
*/ | */ | ||||
virtual void RenderModel(const CShaderProgramPtr& shader, int streamflags, CModel* model, CModelRData* data) = 0; | virtual void RenderModel(const CShaderProgramPtr& shader, int streamflags, CModel* model) = 0; | ||||
virtual void RenderModels(const CShaderProgramPtr& shader, int streamflags, const std::vector<CModel*>& models) = 0; | |||||
}; | }; | ||||
#endif // INCLUDED_MODELVERTEXRENDERER | #endif // INCLUDED_MODELVERTEXRENDERER |
Wildfire Games · Phabricator