Вверх ↑
Ответов: 2193
Рейтинг: 673
#1: 2015-01-09 00:50:30 ЛС | профиль | цитата
MAV, насколько понимаю код, то ваши Mesh0 и Mesh1 после:
#pas
Mesh1 := Mesh0;
стали близнецами, получили одни и те же адреса памяти. Так что изменяя Mesh1 вы изменяете и Mesh0:
unit HiAsmUnit;

interface

uses Kol, Share, Debug, OpenGL;

type
TCoord = record // Stores X, Y, Z coordinates
X, Y, Z: glFLoat;
end;

type
TTexCoord = record // Stores texture coordinates
U, V: glFloat;
end;

type
TColorCoord = record // Stores value color
R, G, B: GLubyte;
end;


type
TMesh = record
ModelName: string[80];
GroupName: string[80];
CountV: integer;
PrimType: integer;
idTexture1: array of integer;
idTexture2: array of integer;
Vertexes: array of TCoord;//----------------------
Normals: array of TCoord;
Textures1: array of TTexCoord;
Textures2: array of TTexCoord;
Textures3: array of TTexCoord;
Textures4: array of TTexCoord;
Color: array of TColorCoord;
end;

type
TArrMesh = record
DynamicModeFlag: array of boolean;
NormalsFlag: array of boolean;
TexturesFlag: array of boolean;
nTexturesFlag: array of integer;
ColorFlag: array of boolean;
IdVAOA: array of integer;
IdVAOB: array of integer;
MeshGroupA: array of TMesh;
MeshGroupB: array of TMesh;
end;

var
Mesh0: TMesh; //iniiaiie iannea iaoae
Mesh1: TMesh;
Mesh2: TMesh;
VertexCube: array of TCoord;
NormalsCube: array of TCoord;
TexCoordsCube: array of TTexCoord;


type
THiAsmClass = class(TDebug)
private

public
onFunc0: THI_Event;
onFunc1: THI_Event;

procedure doFunc(var Data: TData; index: word);
end;

function SetLengthMesh(Count: integer): boolean;
function DelMeshID(id: integer): boolean;

implementation

function SetLengthMesh(Count: integer): boolean;

begin
Result := True;
end;

function DelMeshID(id: integer): boolean;

begin
Result := True;
end;

procedure THiAsmClass.doFunc(var Data: TData; index: word);
var
Id, CountV, i: integer;
begin
Id := 0;
CountV := 10;
SetLength(Mesh0.Vertexes, 10);
SetLength(Mesh1.Vertexes, 10);

for i := 0 to CountV - 1 do
begin
Mesh0.Vertexes[i].X := 1;
Mesh0.Vertexes[i].Y := 2;
Mesh0.Vertexes[i].Z := 3;//Mesh0.Vertexes[0].Z=3
end;
Mesh1 := Mesh0; //Mesh1.Vertexes[0].Z=3

for i := 0 to CountV - 1 do
begin
Mesh1.Vertexes[i].X := 10;
Mesh1.Vertexes[i].Y := 20;
Mesh1.Vertexes[i].Z := 30; //Mesh1.Vertexes[0].Z=30
end;
_debug(double2str(Mesh0.Vertexes[0].Z));
_debug(double2str(Mesh1.Vertexes[0].Z));
Mesh1.Vertexes := nil;
//SetLength(Mesh1.Vertexes, 10);
Mesh1 := Mesh0; //??? //Mesh1.Vertexes[1].Z <> 3 ????

//_hi_OnEvent(onFunc0, high(Mesh1.Vertexes));
_hi_OnEvent(onFunc1, Mesh1.Vertexes[0].Z);
end;

end.
Если не ошибаюсь то решается это вот так:
code_34869.txt
Но могу ошибаться
карма: 10

1
файлы: 1code_34869.txt [3.2KB] [478]
Голосовали:MAV