2014-11-25 20:41:19 +00:00
|
|
|
//
|
|
|
|
// Copyright 2014 DreamWorks Animation LLC.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
// with the following modification; you may not use this file except in
|
|
|
|
// compliance with the Apache License and the following modification to it:
|
|
|
|
// Section 6. Trademarks. is deleted and replaced with:
|
|
|
|
//
|
|
|
|
// 6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
// names, trademarks, service marks, or product names of the Licensor
|
|
|
|
// and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
// the License and to reproduce the content of the NOTICE file.
|
|
|
|
//
|
|
|
|
// You may obtain a copy of the Apache License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the Apache License with the above modification is
|
|
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
// KIND, either express or implied. See the Apache License for the specific
|
|
|
|
// language governing permissions and limitations under the Apache License.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "../far/patchDescriptor.h"
|
|
|
|
|
|
|
|
#include <cassert>
|
2015-02-26 21:57:47 +00:00
|
|
|
#include <cstdio>
|
2014-11-25 20:41:19 +00:00
|
|
|
|
|
|
|
namespace OpenSubdiv {
|
|
|
|
namespace OPENSUBDIV_VERSION {
|
|
|
|
|
|
|
|
namespace Far {
|
|
|
|
|
|
|
|
|
2015-02-11 22:25:44 +00:00
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
//
|
2015-02-11 22:25:44 +00:00
|
|
|
// Lists of valid patch Descriptors for each subdivision scheme
|
2014-11-25 20:41:19 +00:00
|
|
|
//
|
|
|
|
|
2015-02-11 22:25:44 +00:00
|
|
|
ConstPatchDescriptorArray
|
|
|
|
PatchDescriptor::GetAdaptivePatchDescriptors(Sdc::SchemeType type) {
|
2014-11-25 20:41:19 +00:00
|
|
|
|
2015-02-11 22:25:44 +00:00
|
|
|
static PatchDescriptor _loopDescriptors[] = {
|
|
|
|
// XXXX work in progress !
|
2015-04-17 14:42:53 +00:00
|
|
|
PatchDescriptor(LOOP),
|
2015-02-11 22:25:44 +00:00
|
|
|
};
|
2014-11-25 20:41:19 +00:00
|
|
|
|
2015-02-11 22:25:44 +00:00
|
|
|
static PatchDescriptor _catmarkDescriptors[] = {
|
2014-11-25 20:41:19 +00:00
|
|
|
|
2015-04-17 14:42:53 +00:00
|
|
|
// XXXdyu-patch-drawing
|
|
|
|
PatchDescriptor(REGULAR),
|
|
|
|
PatchDescriptor(BOUNDARY),
|
|
|
|
PatchDescriptor(CORNER),
|
|
|
|
PatchDescriptor(GREGORY),
|
|
|
|
PatchDescriptor(GREGORY_BOUNDARY),
|
|
|
|
PatchDescriptor(GREGORY_BASIS),
|
2015-02-11 22:25:44 +00:00
|
|
|
};
|
2014-11-25 20:41:19 +00:00
|
|
|
|
|
|
|
switch (type) {
|
2015-02-11 22:25:44 +00:00
|
|
|
case Sdc::SCHEME_BILINEAR :
|
|
|
|
return ConstPatchDescriptorArray(0, 0);
|
|
|
|
case Sdc::SCHEME_CATMARK :
|
|
|
|
return ConstPatchDescriptorArray(_catmarkDescriptors,
|
|
|
|
(int)(sizeof(_catmarkDescriptors)/sizeof(PatchDescriptor)));
|
|
|
|
case Sdc::SCHEME_LOOP :
|
|
|
|
return ConstPatchDescriptorArray(_loopDescriptors,
|
|
|
|
(int)(sizeof(_loopDescriptors)/sizeof(PatchDescriptor)));
|
2014-11-25 20:41:19 +00:00
|
|
|
default:
|
|
|
|
assert(0);
|
|
|
|
}
|
2015-02-11 22:25:44 +00:00
|
|
|
return ConstPatchDescriptorArray(0, 0);;
|
2014-11-25 20:41:19 +00:00
|
|
|
}
|
|
|
|
|
2015-02-26 21:57:47 +00:00
|
|
|
void
|
|
|
|
PatchDescriptor::print() const {
|
|
|
|
static char const * types[13] = {
|
|
|
|
"NON_PATCH", "POINTS", "LINES", "QUADS", "TRIANGLES", "LOOP", "REGULAR",
|
|
|
|
"SINGLE_CREASE", "BOUNDARY", "CORNER", "GREGORY",
|
|
|
|
"GREGORY_BOUNDARY", "GREGORY_BASIS" };
|
|
|
|
|
2015-04-17 14:42:53 +00:00
|
|
|
printf(" type %s\n",
|
|
|
|
types[_type]);
|
2015-02-26 21:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-11-25 20:41:19 +00:00
|
|
|
|
|
|
|
} // end namespace Far
|
|
|
|
|
|
|
|
} // end namespace OPENSUBDIV_VERSION
|
|
|
|
} // end namespace OpenSubdiv
|