demo player movement
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "math/vec4.hpp"
|
||||
#include "../pipeline_shading_type.hpp"
|
||||
#include "../pipeline_texture_mapping_type.hpp"
|
||||
#include "../pipeline_transformation_type.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
@@ -28,6 +29,7 @@ class PipelineInfoBag {
|
||||
|
||||
PipelineShadingType shadingType;
|
||||
PipelineTextureMappingType textureMappingType;
|
||||
PipelineTransformationType transformationType;
|
||||
bool blendingEnabled;
|
||||
bool antiAliasingEnabled;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "../shared/pipeline_shading_type.hpp"
|
||||
#include "../shared/pipeline_lighting_options.hpp"
|
||||
#include "../shared/pipeline_texture_mapping_type.hpp"
|
||||
#include "../shared/pipeline_transformation_type.hpp"
|
||||
#include "./pipeline_frustum_culling.hpp"
|
||||
|
||||
namespace Tyra {
|
||||
@@ -25,15 +26,28 @@ class PipelineOptions {
|
||||
blendingEnabled = true;
|
||||
shadingType = TyraShadingFlat;
|
||||
textureMappingType = TyraLinear;
|
||||
transformationType = TyraMVP;
|
||||
}
|
||||
~PipelineOptions() {}
|
||||
|
||||
/** Type of frustum culling */
|
||||
PipelineFrustumCulling frustumCulling;
|
||||
|
||||
/** Flat or gouraud */
|
||||
PipelineShadingType shadingType;
|
||||
|
||||
/** Linear or nearest */
|
||||
PipelineTextureMappingType textureMappingType;
|
||||
|
||||
/** Blending texture with color */
|
||||
bool blendingEnabled;
|
||||
|
||||
/** Anti-aliasing */
|
||||
bool antiAliasingEnabled;
|
||||
|
||||
/** Multiply by model matrix by MVP or MP */
|
||||
PipelineTransformationType transformationType;
|
||||
|
||||
/** Optional */
|
||||
PipelineLightingOptions* lighting;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
# ______ ____ ___
|
||||
# | \/ ____| |___|
|
||||
# | | | \ | |
|
||||
#-----------------------------------------------------------------------
|
||||
# Copyright 2022, tyra - https://github.com/h4570/tyra
|
||||
# Licenced under Apache License 2.0
|
||||
# Sandro Sobczyński <sandro.sobczynski@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Tyra {
|
||||
|
||||
enum PipelineTransformationType {
|
||||
/** Multiplies model by view and projection matrix */
|
||||
TyraMVP,
|
||||
/** Multiplies model by only projection matrix */
|
||||
TyraMP,
|
||||
};
|
||||
|
||||
} // namespace Tyra
|
||||
@@ -63,7 +63,11 @@ void DynPipCore::initParts(DynPipBag* bag) {
|
||||
texBuffers = new RendererCoreTextureBuffers{temp.id, temp.core, temp.clut};
|
||||
}
|
||||
|
||||
mvp = rendererCore->renderer3D.getViewProj() * *bag->info->model;
|
||||
if (bag->info->transformationType == TyraMP) {
|
||||
mvp = rendererCore->renderer3D.getProjection() * *bag->info->model;
|
||||
} else {
|
||||
mvp = rendererCore->renderer3D.getViewProj() * *bag->info->model;
|
||||
}
|
||||
|
||||
qbufferRenderer.sendObjectData(bag, &mvp, texBuffers);
|
||||
|
||||
|
||||
@@ -212,11 +212,13 @@ PipelineInfoBag* DynamicPipeline::getInfoBag(DynamicMesh* mesh,
|
||||
result->blendingEnabled = options->blendingEnabled;
|
||||
result->shadingType = options->shadingType;
|
||||
result->textureMappingType = options->textureMappingType;
|
||||
result->transformationType = options->transformationType;
|
||||
} else {
|
||||
result->antiAliasingEnabled = false;
|
||||
result->blendingEnabled = true;
|
||||
result->shadingType = TyraShadingFlat;
|
||||
result->textureMappingType = TyraLinear;
|
||||
result->transformationType = TyraMVP;
|
||||
}
|
||||
|
||||
result->model = model;
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Tyra {
|
||||
|
||||
PipelineInfoBag::PipelineInfoBag() {
|
||||
shadingType = TyraShadingFlat;
|
||||
transformationType = TyraMVP;
|
||||
textureMappingType = TyraLinear;
|
||||
blendingEnabled = true;
|
||||
antiAliasingEnabled = false;
|
||||
|
||||
@@ -96,6 +96,10 @@ void StaPipCore::render(StaPipBag* bag, const bool& frustumCull,
|
||||
TYRA_ASSERT(
|
||||
!bag->texture || (bag->texture->texture && bag->texture->coordinates),
|
||||
"If you want texture, please provide texture and coordinates!");
|
||||
TYRA_ASSERT(bag->info->transformationType == TyraMVP ||
|
||||
(!bag->info->fullClipChecks && !frustumCull),
|
||||
"Please disable clip checks and frustum culling if not using MVP "
|
||||
"matrix!");
|
||||
TYRA_ASSERT(!(frustumCull == false && bag->info->fullClipChecks == true),
|
||||
"Full clip checks are not supported with frustum culling = off!");
|
||||
|
||||
@@ -126,7 +130,13 @@ void StaPipCore::render(StaPipBag* bag, const bool& frustumCull,
|
||||
|
||||
packager.setRenderBBox(renderBbox);
|
||||
|
||||
auto mvp = rendererCore->renderer3D.getViewProj() * *bag->info->model;
|
||||
M4x4 mvp;
|
||||
|
||||
if (bag->info->transformationType == TyraMP) {
|
||||
mvp = rendererCore->renderer3D.getProjection() * *bag->info->model;
|
||||
} else {
|
||||
mvp = rendererCore->renderer3D.getViewProj() * *bag->info->model;
|
||||
}
|
||||
|
||||
RendererCoreTextureBuffers* texBuffers = nullptr;
|
||||
if (bag->texture) {
|
||||
|
||||
@@ -47,6 +47,11 @@ void StaticPipeline::render(StaticMesh* mesh, const StaPipOptions* options) {
|
||||
!(frustumCulling != PipelineFrustumCulling_Precise &&
|
||||
infoBag->fullClipChecks == true),
|
||||
"Full clip checks are only supported with frustum culling == Precise!");
|
||||
TYRA_ASSERT(options->transformationType == TyraMVP ||
|
||||
(!options->fullClipChecks &&
|
||||
options->frustumCulling == PipelineFrustumCulling_None),
|
||||
"Please disable clip checks and frustum culling if not using MVP "
|
||||
"matrix!");
|
||||
|
||||
if (frustumCulling == PipelineFrustumCulling_Simple) {
|
||||
auto* frame = mesh->getFrame();
|
||||
@@ -95,12 +100,14 @@ PipelineInfoBag* StaticPipeline::getInfoBag(StaticMesh* mesh,
|
||||
result->shadingType = options->shadingType;
|
||||
result->fullClipChecks = options->fullClipChecks;
|
||||
result->textureMappingType = options->textureMappingType;
|
||||
result->transformationType = options->transformationType;
|
||||
} else {
|
||||
result->antiAliasingEnabled = false;
|
||||
result->blendingEnabled = true;
|
||||
result->shadingType = TyraShadingFlat;
|
||||
result->textureMappingType = TyraLinear;
|
||||
result->fullClipChecks = false;
|
||||
result->transformationType = TyraMVP;
|
||||
}
|
||||
|
||||
result->model = model;
|
||||
|
||||
Reference in New Issue
Block a user