2017-01-04 01:10:02 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
|
|
|
//
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
//
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
#include "RivWellFracturePartMgr.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
#include "RiaApplication.h"
|
|
|
|
|
2017-01-06 03:26:57 -06:00
|
|
|
#include "RimEclipseView.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
#include "RimEclipseWell.h"
|
|
|
|
#include "RimFracture.h"
|
2017-02-28 07:28:14 -06:00
|
|
|
#include "RimFractureTemplate.h"
|
2017-02-20 02:31:24 -06:00
|
|
|
#include "RimLegendConfig.h"
|
|
|
|
#include "RimStimPlanColors.h"
|
|
|
|
#include "RimStimPlanFractureTemplate.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
|
2017-02-20 04:10:03 -06:00
|
|
|
#include "RivPartPriority.h"
|
2017-02-23 04:53:26 -06:00
|
|
|
#include "RivObjectSourceInfo.h"
|
2017-02-20 04:10:03 -06:00
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
#include "cafDisplayCoordTransform.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
#include "cafEffectGenerator.h"
|
|
|
|
|
|
|
|
#include "cvfDrawableGeo.h"
|
|
|
|
#include "cvfModelBasicList.h"
|
|
|
|
#include "cvfPart.h"
|
|
|
|
#include "cvfPrimitiveSet.h"
|
|
|
|
#include "cvfPrimitiveSetIndexedUInt.h"
|
2017-02-14 03:29:25 -06:00
|
|
|
#include "cvfScalarMapperContinuousLinear.h"
|
2017-02-28 07:28:14 -06:00
|
|
|
#include "cvfRenderStateDepth.h"
|
2017-01-04 01:10:02 -06:00
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-19 00:28:04 -06:00
|
|
|
RivWellFracturePartMgr::RivWellFracturePartMgr(RimFracture* fracture)
|
|
|
|
: m_rimFracture(fracture)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-19 00:28:04 -06:00
|
|
|
RivWellFracturePartMgr::~RivWellFracturePartMgr()
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-19 00:28:04 -06:00
|
|
|
void RivWellFracturePartMgr::updatePartGeometry(caf::DisplayCoordTransform* displayCoordTransform)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2017-01-19 00:28:04 -06:00
|
|
|
if (m_part.notNull()) return;
|
|
|
|
if (!displayCoordTransform) return;
|
2017-01-04 01:10:02 -06:00
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
if (m_rimFracture)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2017-01-19 00:28:04 -06:00
|
|
|
if (!m_rimFracture->hasValidGeometry())
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2017-01-19 00:28:04 -06:00
|
|
|
m_rimFracture->computeGeometry();
|
2017-01-04 01:10:02 -06:00
|
|
|
}
|
2017-01-06 03:26:57 -06:00
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
if (!m_rimFracture->hasValidGeometry()) return;
|
2017-01-06 03:26:57 -06:00
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
const std::vector<cvf::Vec3f>& nodeCoords = m_rimFracture->nodeCoords();
|
|
|
|
const std::vector<cvf::uint>& triangleIndices = m_rimFracture->triangleIndices();
|
|
|
|
std::vector<cvf::Vec3f> displayCoords;
|
|
|
|
|
2017-02-03 03:14:02 -06:00
|
|
|
for (size_t i = 0; i < nodeCoords.size(); i++)
|
2017-01-19 00:28:04 -06:00
|
|
|
{
|
|
|
|
cvf::Vec3d nodeCoordsDouble = static_cast<cvf::Vec3d>(nodeCoords[i]);
|
|
|
|
cvf::Vec3d displayCoordsDouble = displayCoordTransform->transformToDisplayCoord(nodeCoordsDouble);
|
|
|
|
displayCoords.push_back(static_cast<cvf::Vec3f>(displayCoordsDouble));
|
|
|
|
}
|
2017-01-06 03:26:57 -06:00
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
cvf::ref<cvf::DrawableGeo> geo = createGeo(triangleIndices, displayCoords);
|
2017-01-06 03:26:57 -06:00
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
m_part = new cvf::Part;
|
|
|
|
m_part->setDrawable(geo.p());
|
|
|
|
|
2017-02-23 03:15:56 -06:00
|
|
|
cvf::Color4f fractureColor = cvf::Color4f(cvf::Color3f(cvf::Color3::BROWN));
|
2017-01-19 00:28:04 -06:00
|
|
|
|
2017-02-23 03:15:56 -06:00
|
|
|
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
|
|
|
if (activeView)
|
|
|
|
{
|
2017-02-23 04:25:21 -06:00
|
|
|
fractureColor = cvf::Color4f(activeView->stimPlanColors->defaultColor());
|
2017-02-23 03:15:56 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
caf::SurfaceEffectGenerator surfaceGen(fractureColor, caf::PO_1);
|
|
|
|
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
2017-01-19 00:28:04 -06:00
|
|
|
m_part->setEffect(eff.p());
|
2017-02-23 04:53:26 -06:00
|
|
|
|
|
|
|
m_part->setSourceInfo(new RivObjectSourceInfo(m_rimFracture));
|
2017-01-06 03:26:57 -06:00
|
|
|
}
|
2017-01-04 01:10:02 -06:00
|
|
|
}
|
|
|
|
|
2017-02-14 03:29:25 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivWellFracturePartMgr::updatePartGeometryTexture(caf::DisplayCoordTransform* displayCoordTransform)
|
|
|
|
{
|
|
|
|
if (m_part.notNull()) return;
|
|
|
|
if (!displayCoordTransform) return;
|
|
|
|
|
|
|
|
if (m_rimFracture)
|
|
|
|
{
|
|
|
|
if (!m_rimFracture->hasValidGeometry())
|
|
|
|
{
|
|
|
|
m_rimFracture->computeGeometry();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!m_rimFracture->hasValidGeometry()) return;
|
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
RimLegendConfig* legendConfig = nullptr;
|
|
|
|
RimEclipseView* activeView = dynamic_cast<RimEclipseView*>(RiaApplication::instance()->activeReservoirView());
|
2017-02-20 06:24:22 -06:00
|
|
|
RimStimPlanColors* stimPlanColors;
|
2017-02-20 02:31:24 -06:00
|
|
|
if (activeView)
|
|
|
|
{
|
2017-02-20 06:24:22 -06:00
|
|
|
stimPlanColors = activeView->stimPlanColors;
|
2017-02-22 08:32:19 -06:00
|
|
|
|
|
|
|
if (stimPlanColors->isChecked())
|
|
|
|
{
|
|
|
|
legendConfig = stimPlanColors->activeLegend();
|
|
|
|
}
|
2017-02-20 02:31:24 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// Note : If no legend is found, draw geo using a single color
|
|
|
|
|
2017-02-15 08:49:53 -06:00
|
|
|
RimFractureTemplate * fracTemplate = m_rimFracture->attachedFractureDefinition();
|
|
|
|
RimStimPlanFractureTemplate* stimPlanFracTemplate;
|
|
|
|
|
|
|
|
if (dynamic_cast<RimStimPlanFractureTemplate*>(fracTemplate))
|
|
|
|
{
|
|
|
|
stimPlanFracTemplate = dynamic_cast<RimStimPlanFractureTemplate*>(fracTemplate);
|
|
|
|
}
|
|
|
|
else return;
|
|
|
|
|
|
|
|
int timeStepIndex = m_rimFracture->stimPlanTimeIndexToPlot;
|
2017-02-20 02:31:24 -06:00
|
|
|
std::vector<std::vector<double> > dataToPlot = stimPlanFracTemplate->getDataAtTimeIndex(activeView->stimPlanColors->resultName(), activeView->stimPlanColors->unit(), timeStepIndex);
|
2017-02-15 08:49:53 -06:00
|
|
|
|
2017-02-14 03:29:25 -06:00
|
|
|
const std::vector<cvf::Vec3f>& nodeCoords = m_rimFracture->nodeCoords();
|
|
|
|
const std::vector<cvf::uint>& triangleIndices = m_rimFracture->triangleIndices();
|
|
|
|
std::vector<cvf::Vec3f> displayCoords;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < nodeCoords.size(); i++)
|
|
|
|
{
|
|
|
|
cvf::Vec3d nodeCoordsDouble = static_cast<cvf::Vec3d>(nodeCoords[i]);
|
|
|
|
cvf::Vec3d displayCoordsDouble = displayCoordTransform->transformToDisplayCoord(nodeCoordsDouble);
|
|
|
|
displayCoords.push_back(static_cast<cvf::Vec3f>(displayCoordsDouble));
|
|
|
|
}
|
|
|
|
|
|
|
|
cvf::ref<cvf::DrawableGeo> geo = createGeo(triangleIndices, displayCoords);
|
|
|
|
|
|
|
|
m_part = new cvf::Part;
|
|
|
|
m_part->setDrawable(geo.p());
|
|
|
|
|
2017-02-28 07:28:14 -06:00
|
|
|
generateFractureOutlinePolygonPart(displayCoordTransform);
|
|
|
|
|
2017-02-22 08:32:19 -06:00
|
|
|
float opacityLevel = activeView->stimPlanColors->opacityLevel();
|
2017-02-20 02:31:24 -06:00
|
|
|
if (legendConfig)
|
|
|
|
{
|
|
|
|
cvf::ScalarMapper* scalarMapper = legendConfig->scalarMapper();
|
2017-02-15 08:14:16 -06:00
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
cvf::ref<cvf::Vec2fArray> textureCoords = new cvf::Vec2fArray;
|
|
|
|
textureCoords->resize(nodeCoords.size());
|
2017-02-15 08:49:53 -06:00
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
int i = 0;
|
|
|
|
for (std::vector<double> depthData : dataToPlot)
|
2017-02-15 08:14:16 -06:00
|
|
|
{
|
2017-02-20 02:31:24 -06:00
|
|
|
std::vector<double> mirroredValuesAtDepth = mirrorDataAtSingleDepth(depthData);
|
|
|
|
for (double gridXdata : mirroredValuesAtDepth)
|
|
|
|
{
|
|
|
|
cvf::Vec2f texCoord = scalarMapper->mapToTextureCoord(gridXdata);
|
2017-02-20 04:03:18 -06:00
|
|
|
|
|
|
|
if (gridXdata > 1e-7)
|
|
|
|
{
|
|
|
|
texCoord[1] = 0; // Set the Y texture coordinate to the opaque line in the texture
|
|
|
|
}
|
2017-02-20 02:31:24 -06:00
|
|
|
textureCoords->set(i, texCoord);
|
2017-02-20 04:03:18 -06:00
|
|
|
|
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
i++;
|
|
|
|
}
|
2017-02-15 08:14:16 -06:00
|
|
|
}
|
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
geo->setTextureCoordArray(textureCoords.p());
|
2017-02-14 03:29:25 -06:00
|
|
|
|
2017-02-20 04:03:18 -06:00
|
|
|
caf::ScalarMapperEffectGenerator effGen(scalarMapper, caf::PO_NEG_LARGE);
|
2017-02-20 06:24:22 -06:00
|
|
|
|
2017-02-27 15:21:37 -06:00
|
|
|
effGen.setOpacityLevel(0.5);
|
|
|
|
effGen.discardTransparentFragments(true);
|
2017-02-20 04:03:18 -06:00
|
|
|
|
|
|
|
if (activeView && activeView->isLightingDisabled())
|
|
|
|
{
|
|
|
|
effGen.disableLighting(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
cvf::ref<cvf::Effect> eff = effGen.generateCachedEffect();
|
2017-02-14 03:29:25 -06:00
|
|
|
|
2017-02-20 02:31:24 -06:00
|
|
|
m_part->setEffect(eff.p());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-27 15:21:37 -06:00
|
|
|
cvf::Color4f fractureColor = cvf::Color4f(activeView->stimPlanColors->defaultColor(), 1.0);
|
2017-02-22 08:32:19 -06:00
|
|
|
|
|
|
|
caf::SurfaceEffectGenerator surfaceGen(fractureColor, caf::PO_1);
|
2017-02-20 02:31:24 -06:00
|
|
|
cvf::ref<cvf::Effect> eff = surfaceGen.generateCachedEffect();
|
|
|
|
m_part->setEffect(eff.p());
|
|
|
|
}
|
2017-02-22 08:32:19 -06:00
|
|
|
|
|
|
|
m_part->setPriority(RivPartPriority::PartType::Transparent);
|
2017-02-23 04:53:26 -06:00
|
|
|
m_part->setSourceInfo(new RivObjectSourceInfo(m_rimFracture));
|
2017-02-14 03:29:25 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-28 07:28:14 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
void RivWellFracturePartMgr::generateFractureOutlinePolygonPart(caf::DisplayCoordTransform* displayCoordTransform)
|
|
|
|
{
|
|
|
|
cvf::ref<cvf::DrawableGeo> polygonGeo = createPolygonDrawable(displayCoordTransform);
|
|
|
|
|
|
|
|
m_polygonPart = new cvf::Part;
|
|
|
|
m_polygonPart->setDrawable(polygonGeo.p());
|
|
|
|
|
|
|
|
m_polygonPart->updateBoundingBox();
|
|
|
|
m_polygonPart->setPriority(RivPartPriority::PartType::Highlight);
|
|
|
|
|
|
|
|
cvf::ref<cvf::Effect> eff;
|
|
|
|
caf::MeshEffectGenerator lineEffGen(cvf::Color3::MAGENTA);
|
|
|
|
eff = lineEffGen.generateUnCachedEffect();
|
|
|
|
|
|
|
|
cvf::ref<cvf::RenderStateDepth> depth = new cvf::RenderStateDepth;
|
|
|
|
depth->enableDepthTest(false);
|
|
|
|
eff->setRenderState(depth.p());
|
|
|
|
|
|
|
|
m_polygonPart->setEffect(eff.p());
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createPolygonDrawable(caf::DisplayCoordTransform* displayCoordTransform)
|
|
|
|
{
|
|
|
|
|
|
|
|
std::vector<cvf::Vec3f> polygon = m_rimFracture->attachedFractureDefinition()->fracturePolygon();
|
|
|
|
|
|
|
|
//Transform to model coordinates and then display coords
|
|
|
|
std::vector<cvf::Vec3f> polygonInDisplayCoords;
|
|
|
|
cvf::Mat4f m = m_rimFracture->transformMatrix();
|
|
|
|
for (cvf::Vec3f v : polygon)
|
|
|
|
{
|
|
|
|
v.transformPoint(m);
|
|
|
|
cvf::Vec3d nodeCoordsDouble = static_cast<cvf::Vec3d>(v);
|
|
|
|
cvf::Vec3d displayCoordsDouble = displayCoordTransform->transformToDisplayCoord(nodeCoordsDouble);
|
|
|
|
polygonInDisplayCoords.push_back(static_cast<cvf::Vec3f>(displayCoordsDouble));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<cvf::uint> lineIndices;
|
|
|
|
std::vector<cvf::Vec3f> vertices;
|
|
|
|
|
|
|
|
for (size_t i = 0; i < polygonInDisplayCoords.size(); ++i)
|
|
|
|
{
|
|
|
|
vertices.push_back(cvf::Vec3f(polygonInDisplayCoords[i]));
|
|
|
|
if (i < polygonInDisplayCoords.size() - 1)
|
|
|
|
{
|
|
|
|
lineIndices.push_back(static_cast<cvf::uint>(i));
|
|
|
|
lineIndices.push_back(static_cast<cvf::uint>(i + 1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vertices.size() == 0) return NULL;
|
|
|
|
|
|
|
|
cvf::ref<cvf::Vec3fArray> vx = new cvf::Vec3fArray;
|
|
|
|
vx->assign(vertices);
|
|
|
|
cvf::ref<cvf::UIntArray> idxes = new cvf::UIntArray;
|
|
|
|
idxes->assign(lineIndices);
|
|
|
|
|
|
|
|
cvf::ref<cvf::PrimitiveSetIndexedUInt> prim = new cvf::PrimitiveSetIndexedUInt(cvf::PT_LINES);
|
|
|
|
prim->setIndices(idxes.p());
|
|
|
|
|
|
|
|
cvf::ref<cvf::DrawableGeo> polygonGeo = new cvf::DrawableGeo;
|
|
|
|
polygonGeo->setVertexArray(vx.p());
|
|
|
|
polygonGeo->addPrimitiveSet(prim.p());
|
|
|
|
|
|
|
|
return polygonGeo;
|
|
|
|
}
|
|
|
|
|
2017-02-15 08:14:16 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
std::vector<double> RivWellFracturePartMgr::mirrorDataAtSingleDepth(std::vector<double> depthData)
|
|
|
|
{
|
|
|
|
std::vector<double> mirroredValuesAtGivenDepth;
|
|
|
|
mirroredValuesAtGivenDepth.push_back(depthData[0]);
|
|
|
|
for (int i = 1; i < (depthData.size()); i++) //starting at 1 since we don't want center value twice
|
|
|
|
{
|
|
|
|
double valueAtGivenX = depthData[i];
|
|
|
|
mirroredValuesAtGivenDepth.insert(mirroredValuesAtGivenDepth.begin(), valueAtGivenX);
|
|
|
|
mirroredValuesAtGivenDepth.push_back(valueAtGivenX);
|
|
|
|
}
|
|
|
|
|
|
|
|
return mirroredValuesAtGivenDepth;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-01-04 01:10:02 -06:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-19 00:28:04 -06:00
|
|
|
void RivWellFracturePartMgr::appendGeometryPartsToModel(cvf::ModelBasicList* model, caf::DisplayCoordTransform* displayCoordTransform)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2017-02-16 02:15:23 -06:00
|
|
|
clearGeometryCache();
|
|
|
|
|
2017-02-22 06:29:20 -06:00
|
|
|
if (!m_rimFracture->isChecked()) return;
|
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
if (m_part.isNull())
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
2017-02-15 08:14:16 -06:00
|
|
|
if (m_rimFracture->attachedFractureDefinition())
|
|
|
|
{
|
|
|
|
if (dynamic_cast<RimStimPlanFractureTemplate*>(m_rimFracture->attachedFractureDefinition()))
|
|
|
|
{
|
|
|
|
updatePartGeometryTexture(displayCoordTransform);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
updatePartGeometry(displayCoordTransform);
|
|
|
|
}
|
|
|
|
}
|
2017-01-19 00:28:04 -06:00
|
|
|
}
|
2017-01-04 01:10:02 -06:00
|
|
|
|
2017-01-19 00:28:04 -06:00
|
|
|
if (m_part.notNull())
|
|
|
|
{
|
|
|
|
model->addPart(m_part.p());
|
2017-01-04 01:10:02 -06:00
|
|
|
}
|
2017-02-28 07:28:14 -06:00
|
|
|
if (m_rimFracture->showPolygonFractureOutline() && m_polygonPart.notNull())
|
|
|
|
{
|
|
|
|
model->addPart(m_polygonPart.p());
|
|
|
|
}
|
2017-01-04 01:10:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-01-19 00:28:04 -06:00
|
|
|
void RivWellFracturePartMgr::clearGeometryCache()
|
|
|
|
{
|
|
|
|
m_part = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2017-02-14 03:29:25 -06:00
|
|
|
cvf::ref<cvf::DrawableGeo> RivWellFracturePartMgr::createGeo(const std::vector<cvf::uint>& triangleIndices, const std::vector<cvf::Vec3f>& nodeCoords)
|
2017-01-04 01:10:02 -06:00
|
|
|
{
|
|
|
|
cvf::ref<cvf::DrawableGeo> geo = new cvf::DrawableGeo;
|
|
|
|
|
2017-02-14 03:29:25 -06:00
|
|
|
cvf::ref<cvf::UIntArray> indices = new cvf::UIntArray(triangleIndices);
|
2017-01-04 01:10:02 -06:00
|
|
|
cvf::ref<cvf::Vec3fArray> vertices = new cvf::Vec3fArray(nodeCoords);
|
|
|
|
|
|
|
|
geo->setVertexArray(vertices.p());
|
|
|
|
geo->addPrimitiveSet(new cvf::PrimitiveSetIndexedUInt(cvf::PT_TRIANGLES, indices.p()));
|
2017-01-11 01:02:23 -06:00
|
|
|
geo->computeNormals();
|
2017-01-04 01:10:02 -06:00
|
|
|
|
|
|
|
return geo;
|
|
|
|
}
|
|
|
|
|