From: Jack on
void CSimplus6View::Init(const cCamera& defaultCamera, D3DFILLMODE
defaultFillmode)
{

m_Camera = defaultCamera; <<< access violation
m_Fillmode = defaultFillmode;


I defined m_Camera as cCamera
cCamera cam[4]
init(cam[0], D3DFILL_MODE);
////////////////////////////////////////////
class cCamera
{
public:
cCamera();

bool isOrtho() const;

const cMatrix4& view() const;
const cMatrix4& proj() const;
const cMatrix4& viewProj() const;

const cVector3& right() const;
const cVector3& up() const;
const cVector3& look() const;

cVector3& pos();

void lookAt (cVector3& pos, cVector3& target, cVector3& up);
void setLens (float fov, float aspect, float nearZ, float farZ);
void setOrthoLens (float width, float height, float nearZ, float farZ);
void setSpeed (float s);

bool isVisible(const AABB& box) const;

public:
void buildView();
void buildWorldFrustumPlanes();

public:
bool m_IsOrtho;

cMatrix4 m_ViewCam;
cMatrix4 m_Proj;
cMatrix4 m_ViewProj;

cVector3 m_PosW;
cVector3 m_RightW;
cVector3 m_UpW;
cVector3 m_LookW;

float m_fSpeed;

D3DXPLANE m_FrustumPlanes[6];

};

////////
Any help would be greatly appreciated.
Jack


From: SvenC on
Hi Jack,

> void CSimplus6View::Init(const cCamera& defaultCamera, D3DFILLMODE
> defaultFillmode)
> {
>
> m_Camera = defaultCamera; <<< access violation
> m_Fillmode = defaultFillmode;
....
> cMatrix4 m_ViewCam;
> cMatrix4 m_Proj;
> cMatrix4 m_ViewProj;
>
> cVector3 m_PosW;
> cVector3 m_RightW;
> cVector3 m_UpW;
> cVector3 m_LookW;

Seems like the assignment operator of cMatrix4 or cVector3
cause that AV.

--
SvenC
From: Alf P. Steinbach on
* Jack:
> void CSimplus6View::Init(const cCamera& defaultCamera, D3DFILLMODE
> defaultFillmode)
> {
>
> m_Camera = defaultCamera; <<< access violation
> m_Fillmode = defaultFillmode;
>
>
> I defined m_Camera as cCamera
> cCamera cam[4]
> init(cam[0], D3DFILL_MODE);


> ////////////////////////////////////////////
> class cCamera
> {
> public:
> cCamera();
>
> bool isOrtho() const;
>
> const cMatrix4& view() const;
> const cMatrix4& proj() const;
> const cMatrix4& viewProj() const;
>
> const cVector3& right() const;
> const cVector3& up() const;
> const cVector3& look() const;
>
> cVector3& pos();
>
> void lookAt (cVector3& pos, cVector3& target, cVector3& up);
> void setLens (float fov, float aspect, float nearZ, float farZ);
> void setOrthoLens (float width, float height, float nearZ, float farZ);
> void setSpeed (float s);
>
> bool isVisible(const AABB& box) const;
>
> public:
> void buildView();
> void buildWorldFrustumPlanes();
>
> public:
> bool m_IsOrtho;
>
> cMatrix4 m_ViewCam;
> cMatrix4 m_Proj;
> cMatrix4 m_ViewProj;
>
> cVector3 m_PosW;
> cVector3 m_RightW;
> cVector3 m_UpW;
> cVector3 m_LookW;
>
> float m_fSpeed;
>
> D3DXPLANE m_FrustumPlanes[6];
>
> };
>
> ////////
> Any help would be greatly appreciated.
> Jack

Post a small example that compiles and exhibits the problem.

Or use your debugger to find exactly where that access violation occurs.

The technical problem is probably in one of the classes cMatrix4, cVector3
and/or D3DXPLANE.


Cheers, & hth.,

- Alf

PS: Why on Earth are you sticking a "c" in front of the class names? It doesn't
exactly make the program text more readable.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
From: Jack on
>
> m_Camera = defaultCamera; <<< access violation
> m_Fillmode = defaultFillmode;
>
>
> I defined m_Camera as cCamera
> cCamera cam[4]
> init(cam[0], D3DFILL_MODE);
> ////////////////////////////////////////////
> class cCamera
> {
> public:
> cCamera();
>
> bool isOrtho() const;
>
> const cMatrix4& view() const;
> const cMatrix4& proj() const;
> const cMatrix4& viewProj() const;
>
> const cVector3& right() const;
> const cVector3& up() const;
> const cVector3& look() const;
>
> cVector3& pos();
>
> void lookAt (cVector3& pos, cVector3& target, cVector3& up);
> void setLens (float fov, float aspect, float nearZ, float farZ);
> void setOrthoLens (float width, float height, float nearZ, float farZ);
> void setSpeed (float s);
>
> bool isVisible(const AABB& box) const;
>
> public:
> void buildView();
> void buildWorldFrustumPlanes();
>
> public:
> bool m_IsOrtho;
>
> cMatrix4 m_ViewCam;
> cMatrix4 m_Proj;
> cMatrix4 m_ViewProj;
>
> cVector3 m_PosW;
> cVector3 m_RightW;
> cVector3 m_UpW;
> cVector3 m_LookW;
>
> float m_fSpeed;
>
> D3DXPLANE m_FrustumPlanes[6];
>
> };
>
> ////////
> Any help would be greatly appreciated.
> Jack
Thanks both of you. It is caused by omission of some methods I needed to
implement.... Thanks a lot
Jack

>
>