Beispiel #1
0
WGLWidget::JavaScriptMatrix4x4 WGLWidget::createJavaScriptMatrix4()
{
  WGenericMatrix<double, 4, 4> m; // unit matrix
  JavaScriptMatrix4x4 retval("ctx.WtMatrix" + boost::lexical_cast<std::string>(matrices_++));
  js_ << retval.jsRef() << "=";
  renderfv(js_, m.data().begin(), m.data().end());
  js_ << ";";

  GLDEBUG;
  return retval;
}
Beispiel #2
0
WGLWidget::JavaScriptMatrix4x4 WGLWidget::JavaScriptMatrix4x4::operator*(const WGenericMatrix<double, 4, 4> &m) const
{
  std::stringstream ss;
  ss << WT_CLASS ".glMatrix.mat4.multiply(" << jsRef_ << ",";
  WGenericMatrix<double, 4, 4> t(m.transposed());
  renderfv(ss, t.data().begin(), t.data().end());
  ss << ", " WT_CLASS ".glMatrix.mat4.create())";
  return WGLWidget::JavaScriptMatrix4x4(ss.str());
}
Beispiel #3
0
WGLWidget::JavaScriptMatrix4x4 WGLWidget::JavaScriptMatrix4x4::operator*(const WGenericMatrix<double, 4, 4> &m) const
#else 
WGLWidget::JavaScriptMatrix4x4 WGLWidget::JavaScriptMatrix4x4::multiply(const WGenericMatrix<double, 4, 4> &m) const
#endif 
{
  if (!initialized())
    throw WException("JavaScriptMatrix4x4: matrix not initialized");
  WGLWidget::JavaScriptMatrix4x4 copy = WGLWidget::JavaScriptMatrix4x4(*this);
  std::stringstream ss;
  ss << WT_CLASS ".glMatrix.mat4.multiply(" << jsRef_ << ",";
  WGenericMatrix<double, 4, 4> t(m.transposed());
#ifndef WT_TARGET_JAVA
  WClientGLWidget::renderfv(ss, t, context_->pImpl_->arrayType());
#else
  renderfv(ss, t, context_->pImpl_->arrayType());
#endif
  ss << ", " WT_CLASS ".glMatrix.mat4.create())";
  copy.jsRef_ = ss.str();
  copy.operations_.push_back(op::MULTIPLY);
  copy.matrices_.push_back(m);
  return copy;
}