Esempio n. 1
0
int DisplayTree::Render(
    const Matrix& transform,
    const ColorMatrix* color_matrix,
    int clip_width,
    int clip_height,
    renderer_base& ren_base,
    renderer_scanline& ren) const {

  if (!visible) return 0;
  Matrix m(transform);
  if (placement) {
    m.premultiply(placement->matrix);
  }
  m.premultiply(matrix);
  const ColorMatrix* color_m = color_matrix;
  if (const ColorMatrix* cm = GetColorMatrix()) {
    // We don't currently support multiplying color matrices.
    assert(color_m == NULL);
    color_m = cm;
  }
  if (shape) {
    RenderShape(*shape, m, color_m, clip_width, clip_height, ren_base, ren);
  }
  for (std::vector<DisplayTree*>::const_iterator it =
         children.begin(); it != children.end(); ++it) {
    (*it)->Render(m, color_m, clip_width, clip_height, ren_base, ren);
  }
  return 0;
}
Esempio n. 2
0
void Player::RenderText(TextCharacter* pText, const ColorTransform& colorTransform, UI::Graphics* pGraphics)
{
	//TextCharacter::_TextCharacter* pText = (TextCharacter::_TextCharacter*)textCharacter.m_p;

	for (int i = 0; i < pText->m_runs.GetSize(); i++)
	{
		GlyphRun* pRun = pText->m_runs[i];

		double x = pRun->m_XOffset;

		for (int j = 0; j < pRun->m_glyphs.GetSize(); j++)
		{
			/*LDraw::Matrix3f oldTransform =*/ pGraphics->PushTransform();

			RGBAColor color = pRun->m_color;

			color.Red = (color.Red * colorTransform.MulR) / 256 + colorTransform.AddR;
			color.Green = (color.Green * colorTransform.MulR) / 256 + colorTransform.AddG;
			color.Blue = (color.Blue * colorTransform.MulR) / 256 + colorTransform.AddB;
			color.Alpha = (color.Alpha * colorTransform.MulR) / 256 + colorTransform.AddA;

			pGraphics->TranslateTransform(x, pRun->m_YOffset);
			pGraphics->ScaleTransform(pRun->m_fontHeight / 1024.0, pRun->m_fontHeight / 1024.0);
			RenderShape(pRun->m_font->GetGlyph(pRun->m_glyphs[j]), new LDraw::SolidBrush(color), pGraphics);

			pGraphics->PopTransform();//oldTransform);

			x += pRun->m_widths[j];
		}
	}
}
Esempio n. 3
0
void Player::Render(Timeline* timeline, const ColorTransform& colorTransform, UI::Graphics* pGraphics)
{
	for (int i = 0; i < 65536; i++)
	{
		PlacedCharacter* placed = timeline->GetPlacedCharacterAtDepth(i);
		if (placed)
		{
		//	Character def = m_movie.GetCharacter(placed->m_CharacterID);
			Character* def = placed->m_character;

			/*LDraw::Matrix3f oldTransform =*/ pGraphics->PushTransform();

			pGraphics->MultiplyTransform(placed->m_transform);

			ShapeCharacter* shape = dynamic_cast<ShapeCharacter*>(def);
			if (shape != NULL)
			{
				RenderShape(shape, pGraphics);
			}

			TextCharacter* text = dynamic_cast<TextCharacter*>(def);
			if (text != NULL)
			{
				RenderText(text, colorTransform * placed->m_colorTransform, pGraphics);
			}

			Sprite* sprite = dynamic_cast<Sprite*>(def);
			if (sprite != NULL)
			{
				Render(sprite, placed->m_colorTransform, pGraphics);
			}

			/*
			BitmapCharacter bitmap = def;
			if (bitmap != NULL)
			{
				RenderBitmap(bitmap, pGraphics);
			}
			*/

			pGraphics->PopTransform();//oldTransform);
		}
	}
}
void generateTeapot()
{
	Shader shader;
	shader.shaderPointer = shaderProgram;
	shader.uTransform = uTransform;
	shader.uColor = uColor;

	teapot = new B_Spline(RenderShape(vao0, 36, GL_TRIANGLES, shader, glm::vec4(0.0f, 1.0f, 0.0f, 1.0f)), RenderShape(vao1, 2, GL_LINES, shader, glm::vec4(0.0f, 1.0f, 0.0f, 1.0f)), 28);

	for (int i = 0; i < 28; ++i)
	{
		int k = i * 48;

		teapot->SetControlPoints(i,
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),

			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),

			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),

			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]),
			glm::vec3(teapotControlPoints[k++], teapotControlPoints[k++], teapotControlPoints[k++]));
	}

	teapot->transform().position = glm::vec3(0.0f, -1.5f, 0.0f);
}
Esempio n. 5
0
void Player::RenderShape(ShapeCharacter* shape, UI::Graphics* pGraphics)
{
	RenderShape(shape, NULL, pGraphics);
}