1
/**************************************************************************\
3
* This file is part of the Coin 3D visualization library.
4
* Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* ("GPL") version 2 as published by the Free Software Foundation.
9
* See the file LICENSE.GPL at the root directory of this source
10
* distribution for additional information about the GNU GPL.
12
* For using Coin with software that can not be combined with the GNU
13
* GPL, and for taking advantage of the additional benefits of our
14
* support services, please contact Systems in Motion about acquiring
15
* a Coin Professional Edition License.
17
* See http://www.coin3d.org/ for more information.
19
* Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
20
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
22
\**************************************************************************/
25
\class SoMFVec4b SoMFVec4b.h Inventor/fields/SoMFVec4b.h
26
\brief The SoMFVec4b class is a container for SbVec4b vectors.
29
This field is used where nodes, engines or other field containers
30
needs to store an array of vectors with four elements.
32
This field supports application data sharing through a
33
setValuesPointer() method. See SoMField documentation for
34
information on how to use this function.
36
\sa SbVec4b, SoSFVec4b
40
// *************************************************************************
42
#include <Inventor/fields/SoMFVec4b.h>
45
#include <Inventor/fields/SoSubFieldP.h>
46
#include <Inventor/SoInput.h>
47
#include <Inventor/errors/SoDebugError.h>
51
// *************************************************************************
53
SO_MFIELD_SOURCE(SoMFVec4b, SbVec4b, SbVec4b);
55
SO_MFIELD_SETVALUESPOINTER_SOURCE(SoMFVec4b, SbVec4b, SbVec4b);
56
SO_MFIELD_SETVALUESPOINTER_SOURCE(SoMFVec4b, SbVec4b, int8_t);
58
// *************************************************************************
60
// Override from parent class.
62
SoMFVec4b::initClass(void)
64
SO_MFIELD_INTERNAL_INIT_CLASS(SoMFVec4b);
67
// *************************************************************************
69
// No need to document readValue() and writeValue() here, as the
70
// necessary information is provided by the documentation of the
72
#ifndef DOXYGEN_SKIP_THIS
75
SoMFVec4b::read1Value(SoInput * in, int idx)
77
assert(idx < this->maxNum);
79
in->readByte(this->values[idx][0]) &&
80
in->readByte(this->values[idx][1]) &&
81
in->readByte(this->values[idx][2]) &&
82
in->readByte(this->values[idx][3]);
86
SoMFVec4b::write1Value(SoOutput * out, int idx) const
88
sosfvec4b_write_value(out, (*this)[idx]);
91
#endif // DOXYGEN_SKIP_THIS
93
// *************************************************************************
96
Set \a num vector array elements from \a xyzw, starting at index
100
SoMFVec4b::setValues(int start, int numarg, const int8_t xyzw[][4])
102
if(start+numarg > this->maxNum) this->allocValues(start+numarg);
103
else if(start+numarg > this->num) this->num = start+numarg;
105
for(int i=0; i < numarg; i++) this->values[i+start].setValue(xyzw[i]);
106
this->valueChanged();
110
Set the vector at \a idx.
113
SoMFVec4b::set1Value(int idx, int8_t x, int8_t y, int8_t z, int8_t w)
115
this->set1Value(idx, SbVec4b(x, y, z, w));
119
Set the vector at \a idx.
122
SoMFVec4b::set1Value(int idx, const int8_t xyzw[4])
124
this->set1Value(idx, SbVec4b(xyzw));
128
Set this field to contain a single vector with the given
132
SoMFVec4b::setValue(int8_t x, int8_t y, int8_t z, int8_t w)
134
this->setValue(SbVec4b(x,y,z,w));
138
Set this field to contain a single vector with the given
142
SoMFVec4b::setValue(const int8_t xyzw[4])
144
if (xyzw == NULL) this->setNum(0);
145
else this->setValue(SbVec4b(xyzw));
148
// *************************************************************************