2012-06-08 18:18:20 +00:00
|
|
|
//
|
|
|
|
// Copyright (C) Pixar. All rights reserved.
|
|
|
|
//
|
|
|
|
// This license governs use of the accompanying software. If you
|
|
|
|
// use the software, you accept this license. If you do not accept
|
|
|
|
// the license, do not use the software.
|
|
|
|
//
|
|
|
|
// 1. Definitions
|
|
|
|
// The terms "reproduce," "reproduction," "derivative works," and
|
|
|
|
// "distribution" have the same meaning here as under U.S.
|
|
|
|
// copyright law. A "contribution" is the original software, or
|
|
|
|
// any additions or changes to the software.
|
|
|
|
// A "contributor" is any person or entity that distributes its
|
|
|
|
// contribution under this license.
|
|
|
|
// "Licensed patents" are a contributor's patent claims that read
|
|
|
|
// directly on its contribution.
|
|
|
|
//
|
|
|
|
// 2. Grant of Rights
|
|
|
|
// (A) Copyright Grant- Subject to the terms of this license,
|
|
|
|
// including the license conditions and limitations in section 3,
|
|
|
|
// each contributor grants you a non-exclusive, worldwide,
|
|
|
|
// royalty-free copyright license to reproduce its contribution,
|
|
|
|
// prepare derivative works of its contribution, and distribute
|
|
|
|
// its contribution or any derivative works that you create.
|
|
|
|
// (B) Patent Grant- Subject to the terms of this license,
|
|
|
|
// including the license conditions and limitations in section 3,
|
|
|
|
// each contributor grants you a non-exclusive, worldwide,
|
|
|
|
// royalty-free license under its licensed patents to make, have
|
|
|
|
// made, use, sell, offer for sale, import, and/or otherwise
|
|
|
|
// dispose of its contribution in the software or derivative works
|
|
|
|
// of the contribution in the software.
|
|
|
|
//
|
|
|
|
// 3. Conditions and Limitations
|
|
|
|
// (A) No Trademark License- This license does not grant you
|
|
|
|
// rights to use any contributor's name, logo, or trademarks.
|
|
|
|
// (B) If you bring a patent claim against any contributor over
|
|
|
|
// patents that you claim are infringed by the software, your
|
|
|
|
// patent license from such contributor to the software ends
|
|
|
|
// automatically.
|
|
|
|
// (C) If you distribute any portion of the software, you must
|
|
|
|
// retain all copyright, patent, trademark, and attribution
|
|
|
|
// notices that are present in the software.
|
|
|
|
// (D) If you distribute any portion of the software in source
|
|
|
|
// code form, you may do so only under this license by including a
|
|
|
|
// complete copy of this license with your distribution. If you
|
|
|
|
// distribute any portion of the software in compiled or object
|
|
|
|
// code form, you may only do so under a license that complies
|
|
|
|
// with this license.
|
|
|
|
// (E) The software is licensed "as-is." You bear the risk of
|
|
|
|
// using it. The contributors give no express warranties,
|
|
|
|
// guarantees or conditions. You may have additional consumer
|
|
|
|
// rights under your local laws which this license cannot change.
|
|
|
|
// To the extent permitted under your local laws, the contributors
|
|
|
|
// exclude the implied warranties of merchantability, fitness for
|
|
|
|
// a particular purpose and non-infringement.
|
|
|
|
//
|
|
|
|
#ifndef FAR_DISPATCHER_H
|
|
|
|
#define FAR_DISPATCHER_H
|
|
|
|
|
|
|
|
#include "../version.h"
|
|
|
|
|
|
|
|
#include "../far/mesh.h"
|
|
|
|
#include "../far/bilinearSubdivisionTables.h"
|
|
|
|
#include "../far/catmarkSubdivisionTables.h"
|
|
|
|
#include "../far/loopSubdivisionTables.h"
|
2012-08-04 02:51:27 +00:00
|
|
|
#include "../far/vertexEditTables.h"
|
2013-03-08 01:50:15 +00:00
|
|
|
#include "../far/kernelBatch.h"
|
2012-06-08 18:18:20 +00:00
|
|
|
|
|
|
|
namespace OpenSubdiv {
|
|
|
|
namespace OPENSUBDIV_VERSION {
|
|
|
|
|
2012-10-07 00:53:51 +00:00
|
|
|
/// \brief Subdivision process encapsulation layer.
|
|
|
|
///
|
|
|
|
/// The Compute dispatcher allows client code to customize parts or the entire
|
|
|
|
/// computation process. This pattern aims at hiding the logic specific to
|
|
|
|
/// the subdivision algorithms and expose a simplified access to minimalistic
|
|
|
|
/// compute kernels. By default, meshes revert to a default dispatcher that
|
|
|
|
/// implements single-threaded CPU kernels.
|
|
|
|
///
|
|
|
|
/// - derive a dispatcher class from this one
|
|
|
|
/// - override the virtual functions
|
|
|
|
/// - pass the derived dispatcher to the factory (one instance can be shared by many meshes)
|
|
|
|
/// - call the FarMesh::Subdivide() to trigger computations
|
|
|
|
///
|
|
|
|
/// Note : the caller is responsible for deleting a custom dispatcher
|
|
|
|
///
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
class FarDispatcher {
|
|
|
|
public:
|
|
|
|
template <class CONTROLLER>
|
|
|
|
static void Refine(CONTROLLER const *controller, FarKernelBatchVector const & batches, int maxlevel, void * clientdata=0);
|
|
|
|
};
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
template <class CONTROLLER> void
|
|
|
|
FarDispatcher::Refine(CONTROLLER const *controller, FarKernelBatchVector const & batches, int maxlevel, void * clientdata) {
|
|
|
|
|
|
|
|
for (int i = 0; i < (int)batches.size(); ++i) {
|
|
|
|
const FarKernelBatch &batch = batches[i];
|
|
|
|
|
2013-05-07 00:50:58 +00:00
|
|
|
if (maxlevel >= 0 && batch.GetLevel() >= maxlevel) continue;
|
|
|
|
|
|
|
|
switch(batch.GetKernelType()) {
|
|
|
|
case FarKernelBatch::CATMARK_FACE_VERTEX:
|
|
|
|
controller->ApplyCatmarkFaceVerticesKernel(batch, clientdata);
|
|
|
|
break;
|
|
|
|
case FarKernelBatch::CATMARK_EDGE_VERTEX:
|
|
|
|
controller->ApplyCatmarkEdgeVerticesKernel(batch, clientdata);
|
|
|
|
break;
|
|
|
|
case FarKernelBatch::CATMARK_VERT_VERTEX_B:
|
|
|
|
controller->ApplyCatmarkVertexVerticesKernelB(batch, clientdata);
|
|
|
|
break;
|
|
|
|
case FarKernelBatch::CATMARK_VERT_VERTEX_A1:
|
|
|
|
controller->ApplyCatmarkVertexVerticesKernelA1(batch, clientdata);
|
|
|
|
break;
|
|
|
|
case FarKernelBatch::CATMARK_VERT_VERTEX_A2:
|
|
|
|
controller->ApplyCatmarkVertexVerticesKernelA2(batch, clientdata);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FarKernelBatch::LOOP_EDGE_VERTEX:
|
|
|
|
controller->ApplyLoopEdgeVerticesKernel(batch, clientdata);
|
|
|
|
break;
|
|
|
|
case FarKernelBatch::LOOP_VERT_VERTEX_B:
|
|
|
|
controller->ApplyLoopVertexVerticesKernelB(batch, clientdata);
|
|
|
|
break;
|
|
|
|
case FarKernelBatch::LOOP_VERT_VERTEX_A1:
|
|
|
|
controller->ApplyLoopVertexVerticesKernelA1(batch, clientdata);
|
|
|
|
break;
|
|
|
|
case FarKernelBatch::LOOP_VERT_VERTEX_A2:
|
|
|
|
controller->ApplyLoopVertexVerticesKernelA2(batch, clientdata);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FarKernelBatch::BILINEAR_FACE_VERTEX:
|
|
|
|
controller->ApplyBilinearFaceVerticesKernel(batch, clientdata);
|
|
|
|
break;
|
|
|
|
case FarKernelBatch::BILINEAR_EDGE_VERTEX:
|
|
|
|
controller->ApplyBilinearEdgeVerticesKernel(batch, clientdata);
|
|
|
|
break;
|
|
|
|
case FarKernelBatch::BILINEAR_VERT_VERTEX:
|
|
|
|
controller->ApplyBilinearVertexVerticesKernel(batch, clientdata);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case FarKernelBatch::HIERARCHICAL_EDIT:
|
|
|
|
controller->ApplyVertexEdits(batch, clientdata);
|
|
|
|
break;
|
2013-03-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
// -----------------------------------------------------------------------------
|
2012-06-08 18:18:20 +00:00
|
|
|
|
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
template <class U>
|
|
|
|
class FarComputeController
|
|
|
|
{
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
public:
|
|
|
|
void Refine(FarMesh<U> * mesh, int maxlevel=-1) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
2012-08-04 02:51:27 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
2012-08-04 02:51:27 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
void ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const;
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
static FarComputeController _DefaultController;
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
};
|
2012-06-08 18:18:20 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
template<class U> FarComputeController<U> FarComputeController<U>::_DefaultController;
|
2012-08-04 02:51:27 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
template <class U> void
|
|
|
|
FarComputeController<U>::Refine(FarMesh<U> *mesh, int maxlevel) const {
|
2012-08-04 02:51:27 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarDispatcher::Refine(this, mesh->GetKernelBatches(), maxlevel, mesh);
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyBilinearFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarBilinearSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarBilinearSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeFacePoints( batch.GetVertexOffset(),
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyBilinearEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarBilinearSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarBilinearSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeEdgePoints( batch.GetVertexOffset(),
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyBilinearVertexVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarBilinearSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarBilinearSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeVertexPoints( batch.GetVertexOffset(),
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyCatmarkFaceVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarCatmarkSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeFacePoints( batch.GetVertexOffset(),
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyCatmarkEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarCatmarkSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeEdgePoints( batch.GetVertexOffset(),
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyCatmarkVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarCatmarkSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeVertexPointsB( batch.GetVertexOffset(),
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyCatmarkVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarCatmarkSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeVertexPointsA( batch.GetVertexOffset(),
|
|
|
|
false,
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2013-03-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class U> void
|
|
|
|
FarComputeController<U>::ApplyCatmarkVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarCatmarkSubdivisionTables<U> const * subdivision =
|
|
|
|
dynamic_cast<FarCatmarkSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeVertexPointsA( batch.GetVertexOffset(),
|
|
|
|
true,
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2013-03-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class U> void
|
|
|
|
FarComputeController<U>::ApplyLoopEdgeVerticesKernel(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarLoopSubdivisionTables<U> const * subdivision =
|
|
|
|
dynamic_cast<FarLoopSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeEdgePoints( batch.GetVertexOffset(),
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyLoopVertexVerticesKernelB(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarLoopSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarLoopSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeVertexPointsB( batch.GetVertexOffset(),
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyLoopVertexVerticesKernelA1(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarLoopSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarLoopSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeVertexPointsA( batch.GetVertexOffset(),
|
|
|
|
false,
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyLoopVertexVerticesKernelA2(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarLoopSubdivisionTables<U> const * subdivision =
|
2012-12-11 01:15:13 +00:00
|
|
|
dynamic_cast<FarLoopSubdivisionTables<U> const *>(mesh->GetSubdivisionTables());
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
assert(subdivision);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
|
|
|
subdivision->computeVertexPointsA( batch.GetVertexOffset(),
|
|
|
|
true,
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata);
|
2012-06-08 18:18:20 +00:00
|
|
|
}
|
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
template <class U> void
|
2013-03-08 01:50:15 +00:00
|
|
|
FarComputeController<U>::ApplyVertexEdits(FarKernelBatch const &batch, void * clientdata) const {
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2013-03-08 01:50:15 +00:00
|
|
|
FarMesh<U> * mesh = static_cast<FarMesh<U> *>(clientdata);
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
FarVertexEditTables<U> const * vertEdit = mesh->GetVertexEdit();
|
2013-05-07 00:50:58 +00:00
|
|
|
|
2012-09-18 01:41:48 +00:00
|
|
|
if (vertEdit)
|
2013-05-07 00:50:58 +00:00
|
|
|
vertEdit->computeVertexEdits( batch.GetTableIndex(),
|
|
|
|
batch.GetVertexOffset(),
|
|
|
|
batch.GetTableOffset(),
|
|
|
|
batch.GetStart(),
|
|
|
|
batch.GetEnd(),
|
|
|
|
clientdata );
|
2012-08-04 02:51:27 +00:00
|
|
|
}
|
|
|
|
|
2012-06-08 18:18:20 +00:00
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
using namespace OPENSUBDIV_VERSION;
|
|
|
|
|
|
|
|
} // end namespace OpenSubdiv
|
|
|
|
|
|
|
|
#endif /* FAR_DISPATCHER_H */
|