mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 19:41:20 +02:00
Merged cleaned up fader branch from Sam
This commit is contained in:
commit
0f60cca617
3 changed files with 2 additions and 61 deletions
|
@ -343,7 +343,7 @@ public:
|
||||||
// Don't actually crash in debug builds, in case this apparent deadlock is simply from
|
// Don't actually crash in debug builds, in case this apparent deadlock is simply from
|
||||||
// the developer actively debugging code
|
// the developer actively debugging code
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
// deadlockDetectionCrash();
|
deadlockDetectionCrash();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,6 @@
|
||||||
|
|
||||||
const float MARCHING_CUBE_COLLISION_HULL_OFFSET = 0.5;
|
const float MARCHING_CUBE_COLLISION_HULL_OFFSET = 0.5;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A PolyVoxEntity has several interdependent parts:
|
A PolyVoxEntity has several interdependent parts:
|
||||||
|
|
||||||
|
@ -737,39 +736,6 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
|
||||||
!mesh->getIndexBuffer()._buffer) {
|
!mesh->getIndexBuffer()._buffer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if (!_pipelines[0]) {
|
|
||||||
gpu::ShaderPointer vertexShaders[2] = { gpu::Shader::createVertex(std::string(polyvox_vert)), gpu::Shader::createVertex(std::string(polyvox_fade_vert)) };
|
|
||||||
gpu::ShaderPointer pixelShaders[2] = { gpu::Shader::createPixel(std::string(polyvox_frag)), gpu::Shader::createPixel(std::string(polyvox_fade_frag)) };
|
|
||||||
|
|
||||||
gpu::Shader::BindingSet slotBindings;
|
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("materialBuffer"), MATERIAL_GPU_SLOT));
|
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("fadeParametersBuffer"), render::ShapePipeline::Slot::BUFFER::FADE_PARAMETERS));
|
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("xMap"), 0));
|
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("yMap"), 1));
|
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("zMap"), 2));
|
|
||||||
slotBindings.insert(gpu::Shader::Binding(std::string("fadeMaskMap"), render::ShapePipeline::Slot::MAP::FADE_MASK));
|
|
||||||
|
|
||||||
auto state = std::make_shared<gpu::State>();
|
|
||||||
state->setCullMode(gpu::State::CULL_BACK);
|
|
||||||
state->setDepthTest(true, true, gpu::LESS_EQUAL);
|
|
||||||
PrepareStencil::testMaskDrawShape(*state);
|
|
||||||
|
|
||||||
auto wireframeState = std::make_shared<gpu::State>();
|
|
||||||
wireframeState->setCullMode(gpu::State::CULL_BACK);
|
|
||||||
wireframeState->setDepthTest(true, true, gpu::LESS_EQUAL);
|
|
||||||
wireframeState->setFillMode(gpu::State::FILL_LINE);
|
|
||||||
PrepareStencil::testMaskDrawShape(*wireframeState);
|
|
||||||
|
|
||||||
// Two sets of pipelines: normal and fading
|
|
||||||
for (auto i = 0; i < 2; i++) {
|
|
||||||
gpu::ShaderPointer program = gpu::Shader::createProgram(vertexShaders[i], pixelShaders[i]);
|
|
||||||
gpu::Shader::makeProgram(*program, slotBindings);
|
|
||||||
|
|
||||||
_pipelines[i] = gpu::Pipeline::create(program, state);
|
|
||||||
_wireframePipelines[i] = gpu::Pipeline::create(program, wireframeState);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (!_vertexFormat) {
|
if (!_vertexFormat) {
|
||||||
auto vf = std::make_shared<gpu::Stream::Format>();
|
auto vf = std::make_shared<gpu::Stream::Format>();
|
||||||
|
@ -780,12 +746,6 @@ void RenderablePolyVoxEntityItem::render(RenderArgs* args) {
|
||||||
|
|
||||||
gpu::Batch& batch = *args->_batch;
|
gpu::Batch& batch = *args->_batch;
|
||||||
|
|
||||||
// Pick correct Pipeline
|
|
||||||
// bool wireframe = (render::ShapeKey(args->_globalShapeKey).isWireframe());
|
|
||||||
// auto pipelineVariation = isFading() & 1;
|
|
||||||
// auto pipeline = (wireframe ? _wireframePipelines[pipelineVariation]: _pipelines[pipelineVariation]);
|
|
||||||
// batch.setPipeline(pipeline);
|
|
||||||
|
|
||||||
Transform transform(voxelToWorldMatrix());
|
Transform transform(voxelToWorldMatrix());
|
||||||
batch.setModelTransform(transform);
|
batch.setModelTransform(transform);
|
||||||
batch.setInputFormat(_vertexFormat);
|
batch.setInputFormat(_vertexFormat);
|
||||||
|
@ -1691,7 +1651,7 @@ void RenderablePolyVoxEntityItem::bonkNeighbors() {
|
||||||
void RenderablePolyVoxEntityItem::locationChanged(bool tellPhysics) {
|
void RenderablePolyVoxEntityItem::locationChanged(bool tellPhysics) {
|
||||||
EntityItem::locationChanged(tellPhysics);
|
EntityItem::locationChanged(tellPhysics);
|
||||||
|
|
||||||
if (/*!_pipelines[0] ||*/ !render::Item::isValidID(_myItem)) {
|
if (!render::Item::isValidID(_myItem)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
|
render::ScenePointer scene = AbstractViewStateInterface::instance()->getMain3DScene();
|
||||||
|
|
|
@ -44,13 +44,6 @@ void renderShape(RenderArgs* args, const ShapePlumberPointer& shapeContext, cons
|
||||||
auto key = item.getShapeKey() | globalKey;
|
auto key = item.getShapeKey() | globalKey;
|
||||||
if (key.isValid() && !key.hasOwnPipeline()) {
|
if (key.isValid() && !key.hasOwnPipeline()) {
|
||||||
args->_shapePipeline = shapeContext->pickPipeline(args, key);
|
args->_shapePipeline = shapeContext->pickPipeline(args, key);
|
||||||
/* if (!args->_shapePipeline) {
|
|
||||||
if (key.isCustom()) {
|
|
||||||
if (item.defineCustomShapePipeline(*shapeContext, key)) {
|
|
||||||
args->_shapePipeline = shapeContext->pickPipeline(args, key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if (args->_shapePipeline) {
|
if (args->_shapePipeline) {
|
||||||
args->_shapePipeline->prepareShapeItem(args, key, item);
|
args->_shapePipeline->prepareShapeItem(args, key, item);
|
||||||
item.render(args);
|
item.render(args);
|
||||||
|
@ -119,18 +112,6 @@ void render::renderStateSortShapes(const RenderContextPointer& renderContext,
|
||||||
auto& bucket = sortedShapes[pipelineKey];
|
auto& bucket = sortedShapes[pipelineKey];
|
||||||
args->_shapePipeline = shapeContext->pickPipeline(args, pipelineKey);
|
args->_shapePipeline = shapeContext->pickPipeline(args, pipelineKey);
|
||||||
if (!args->_shapePipeline) {
|
if (!args->_shapePipeline) {
|
||||||
/* if (pipelineKey.isCustom()) {
|
|
||||||
if (bucket.front().defineCustomShapePipeline(*shapeContext, pipelineKey)) {
|
|
||||||
args->_shapePipeline = shapeContext->pickPipeline(args, pipelineKey);
|
|
||||||
if (!args->_shapePipeline) {
|
|
||||||
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (auto& item : bucket) {
|
for (auto& item : bucket) {
|
||||||
|
|
Loading…
Reference in a new issue