Recent

Author Topic: How about 3D drawing procedures  (Read 5076 times)

Danail

  • Guest
How about 3D drawing procedures
« on: July 03, 2006, 12:12:10 pm »
It would be nice to develope a component or an unit with calculations for making 3D graphics. If it is an unit it will be the procedures that will calculate the x, y and z coordinates of a point, and their x and y coordinates on the screen, which can be applied for all pixels needed in futura projects, and if it is a component maybe to be something like an image component that to have build in procedures for drawing 3d lines and 3d pixels, maybe its name can be 3d canvas for example... I think that the idea is nice and even though I don't understand much from 3D graphics, I am agree even to take part of the creating the unit or component if noone else wants and when I have time to do this. I know how to make an unit that to be used in the uses section later, however I don't know how to make components and I don't much understand from 3d graphics. My email is: Danail_Angelov@Yahoo.com if you have any idea how such component to be made, or how exactly are these calculated, and how I can start it here in lazarus project so on anyone to be able to develope it please email me or answer here. Thanks in regards. Danail.

CCRDude

  • Hero Member
  • *****
  • Posts: 614
RE: How about 3D drawing procedures
« Reply #1 on: July 03, 2006, 12:50:57 pm »
I would make a unit, not a component. Components are mostly for use in combination with forms, but this would be something more abstract in the first place. Maybe later a display component as an example...

Making a unit isn't that complicated... just fill in the maths:

Code: [Select]
unit Unit1;

{$IFDEF FPC}
{$mode objfpc}{$H+}
{$ENDIF FPC}

interface

uses
  Classes, SysUtils;

type
   T3DPoint = record
      X, Y, Z: integer;
   end;

   { TCoordCalc }

   TCoordCalc = class
   private
     FCameraPos: T3DPoint;
     FViewPoint: T3DPoint;
   public
      procedure Coords3Dto2D(AX, AY, AZ: integer; var BX, BY: integer);
      property CameraPos: T3DPoint read FCameraPos write FCameraPos;
      property ViewPoint: T3DPoint read FViewPoint write FViewPoint;
   end;


procedure SimpleCoords3Dto2D(AX, AY, AZ: integer; var BX, BY: integer);

implementation

procedure SimpleCoords3Dto2D(AX, AY, AZ: integer; var BX, BY: integer);
begin
   BX := somethingdependingon(AX, AY, AZ);
   BY := somethingdependingon(AX, AY, AZ);
end;

{ TCoordCalc }

procedure TCoordCalc.Coords3Dto2D(AX, AY, AZ: integer; var BX, BY: integer);
begin
   BX := somethingdependingon(AX, AY, AZ, FCameraPos);
   BY := somethingdependingon(AX, AY, AZ, FViewPoint);
end;

end.


Well, that's still very basic of course, just something to get started with the unit ;)

Danail

  • Guest
How about 3D drawing procedures
« Reply #2 on: July 03, 2006, 01:39:59 pm »
Thanks CCRDude. Well, lets start together to do the unit. Maybe lated there will be and others who will join us. I managed to understand some things about the 3d points and their coordinates. They are being calculated with the use of matrixces. I have some of them - for the rotation and the converting of 3d point with x, y and z coordinate to 2d coordinate with x and y positions for the screen. I think that we are ready to start and create an Unit with the first sample procedure for converting the x, y and z coordinates into x and y coordinates. How to make our unit possible for all volunteers to develope it?

CCRDude

  • Hero Member
  • *****
  • Posts: 614
How about 3D drawing procedures
« Reply #3 on: July 03, 2006, 04:09:02 pm »
Well, I just gave you the frame, I don't really have time for this with half a dozen other more important things to write ;)

Complete the basic function, write a small demo showing it, and post it on the Wiki as an example would be my suggestion.

 

TinyPortal © 2005-2018