<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Yoshiki Ohshima wrote:
<blockquote cite="mid:uskm9j6jy.wl%25yoshiki@vpri.org" type="cite">
  <pre wrap="">At Fri, 20 Feb 2009 03:11:20 -0800 (PST),
Ang Beepeng wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">
I'm facing problem to pass a float array over to C, to create a plugin. 

Previously, I use variableWordSubclass: to create a class to store floats,
in an array. It works fine, as floats are stored as words.
Now that I need to have an instance variable, I use variableSubclass: to
store floats. It seems like floats are being stored as object in the array
this time. The VM crashes when I try to use to same method to access to the
float array.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  To get a Float object and use the value in C, use #floatValueOf:.
Look at the senders of the method for examples.
  </pre>
</blockquote>
<br>
I'm not sure that this is the right thing, since each Float represents
a double-precision floating point number, and the contents of
FloatArray are single-precision.<br>
<br>
I would look at the primitives in CroquetPlugin, which you can find in
an OpenCroquet or Cobalt image.&nbsp; For example,
#primitiveTransformVector3 transforms a 3-element vector by a 4x4
matrix.&nbsp; Matrix4x4 and Vector3 are both subclasses of FloatArray.<br>
<br>
This might still not be answering your question directly (since you are
talking about adding inst-vars to a 'variable-word' class).&nbsp; My
suggestion would be add another inst-var to hold a separate FloatArray
object which contains your floating point data.<br>
<br>
Josh<br>
<br>
<br>
<blockquote cite="mid:uskm9j6jy.wl%25yoshiki@vpri.org" type="cite">
  <pre wrap="">
-- Yoshiki

  </pre>
</blockquote>
<br>
</body>
</html>